Replaces the socket in a socket-stream, returning the existing socket object without closing it.
comm
replace-socket-stream-socket socket-stream socket => socket-or-nil
| socket-stream⇩ | |
| socket⇩ |
A socket object or nil. |
| socket-or-nil⇩ |
A socket object or nil. |
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 typcially a socket handle, which is an integer representing an file descriptor socket on Unix-like systems or a SOCKET on Microsoft Windows, but when using the Java interface it can also be a Java socket (a jobject of Java 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.
(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.
socket-stream
close-socket-handle
25 TCP and UDP socket communication and SSL
LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:26