Replaces the socket in a socket-stream, returning the existing socket object without closing it.
The function replace-socket-stream-socket
replaces the socket in the socket-stream socket-stream, returning the existing socket object without closing it.
A socket object is normally a socket in the native operating system sense (an integer representing an fd
socket on Unix, and an integer representing SOCKET
on Microsoft Windows), but when using the Java interface it can also be a Java socket (jobject of class java.net.Socket
).
replace-socket-stream-socket
sets the socket in socket-stream to the argument socket, and then returns the old socket object without closing it.
socket-stream-socket
and then using (setf socket-stream-socket)
to set the new one is different, because the cl:setf
will close the old socket.nil
as the socket allows you to close the stream while retaining the socket.LispWorks User Guide and Reference Manual - 13 Feb 2015