开发者

How do I reuse a previously-opened port, using SBCL's sockets?

开发者 https://www.devze.com 2022-12-25 16:10 出处:网络
Creating a server-side socket will fail if I\'m trying to use the same port I\'ve used before.开发者_StackOverflow中文版 An address-in-use error occurs.

Creating a server-side socket will fail if I'm trying to use the same port I've used before.开发者_StackOverflow中文版 An address-in-use error occurs.

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

How do I stop this from happening?

Hints and code snippets very welcome! (CL newbie here.)

Thanks!


Use the SB-BSD-SOCKETS:SOCKET-REUSE-ADDRESS socket option accessor:

(setf (sb-bsd-sockets:socket-reuse-address socket) t)
0

精彩评论

暂无评论...
验证码 换一张
取 消