views:

32

answers:

1

Creating a server-side socket will fail if I'm trying to use the same port I've used before. 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!

+2  A: 

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

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