How to reuse a previously opened port using SBCL sockets?

Creating a server socket will fail if I try to use the same port that I used before. Address error in use.

(make-instance 'sb-bsd-sockets:inet-socket :type :stream :protocol :tcp) 

How can i stop this?

Greetings and code snippets are very welcome! (CL is new to here.)

Thanks!

+4
source share
1 answer

Use the SB-BSD-SOCKETS: SOCKET-REUSE-ADDRESS socket helper module:

 (setf (sb-bsd-sockets:socket-reuse-address socket) t) 
+3
source

Source: https://habr.com/ru/post/1306163/


All Articles