A positive number or
A positive number or
One of the keywords
:both. The default value is
socket-stream implements a buffered stream connected to a socket. The socket handle, specified by
:socket, and the direction, specified by
:direction, must be passed for a meaningful stream to be constructed. Common Lisp input functions such as
read-char will see
end-of-file if the other end of the socket is closed.
:element-type initarg determines the expected element type of the stream traffic. However, stream input and output functions for character and binary data generally work in the obvious way on a
socket-stream with any of the allowed values of element-type. For example,
read-sequence can be called with a string buffer and a binary
socket-stream: the character data is constructed from the input as if by
write-sequence can be called with a string buffer and a binary
socket-stream: the output is converted from the character data as if by
char-code. Also, 8-bit binary data can be read and written to a
The read-timeout property is intended for use when a socket connection might hang during a call to any Common Lisp input function. The read-timeout can be set by make-instance or by open-tcp-stream. It can also be modified by
(setf stream:stream-read-timeout). When read-timeout is
nil, there is no timeout during reads and the call may hang. When read-timeout is not
nil, and there is no input from the socket for more than read-timeout seconds, any reading function returns
end-of-file. The read-timeout does not limit the time inside
read, but the time between successful extractions of data from the socket. Therefore, if the reading needs several rounds it may take longer than read-timeout.
(setf stream:stream-read-timeout) on the stream while it is inside a read function has undefined effects. However, the setf function can be used between calls to read functions. The read-timeout property of a stream can be read by
ssl-ctx, if non-nil, specifies that the stream uses SSL and further specifies the
SSL_CTX object to use. The value of ssl-ctx can be a symbol which, together with ssl-side, specifies which protocol to use. The value
:default means use the default, which is currently the same as
:v23. The values
:tls-v1 are mapped to the
TLSv1_* methods respectively. With these symbol values of ssl-ctx, LispWorks makes a new
SSL_CTX object and uses it and frees it when the stream is closed.
The value of ssl-ctx can also be a foreign pointer of type ssl-ctx-pointer (which corresponds to the C type
SSL_CTX*). This is used and is not freed when the stream is closed. Also an SSL object is made and used, and this object is freed when the stream is closed. The foreign pointer may be a result of a call to make-ssl-ctx, but it can also a result of user code, provided that it points to a valid
SSL_CTX and has the type ssl-ctx-pointer.
The value of ssl-ctx can also be a foreign pointer of type ssl-pointer (which corresponds to the C type
SSL*). This specifies the SSL to use. This maybe a result of a call to ssl-new but can also be the result of user code, provided that it points to a valid SSL object and has the type ssl-pointer. The SSL is used and is not freed when the stream is closed.
SSL_CTXobject is created, it is used to select the method:
:client => *_client_method
:server => *_server_method
:both => *_method
:server, LispWorks calls
If the value of ssl-ctx is a ssl-pointer, ssl-side is ignored.
ctx-configure-callback specifies a callback, a function which takes a foreign pointer of type ssl-ctx-pointer. This is called immediately after a new
SSL_CTX is created. If the value of ssl-ctx is not a symbol, ctx-configure-callback is ignored.
ssl-configure-callback specifies a callback, a function which takes a foreign pointer of type ssl-pointer. This is called immediately after a new SSL is created. If the value of ssl-ctx is a ssl-pointer, ssl-configure-callback is ignored.
cl:read-charand so on) can also wait properly. You can also use process-wait and similar functions with
cl:listenin the wait-function, but you will need to use with-noticed-socket-stream.
socket-streamis normally a socket object in the operating system sense. On Unix and Microsoft Windows it is an integer corresponding to a socket as returned from the C functions socket and accept. It can also be a Java socket object, see Socket streams with Java sockets and SSL on Android for details.
(setf socket-steam-socket)can be used to set the socket object in the stream, and can also set it to
nil. When there is already a socket in the stream,
(setf socket-steam-socket)closes it before setting the slot to the new socket. The function replace-socket-stream-socket can be used to set the socket without closing the old one.
LispWorks User Guide and Reference Manual - 13 Feb 2015