chickadee » socket » set-socket-option

set-socket-option s level name valprocedure

Set the value of option name at socket level level on socket s to val. val may be a fixnum or a boolean. It may also be a blob or a string; if so, the raw contents are passed to the option, which is useful when a structure is required. The return value is unspecified.

If an unsupported option or level is requested, a condition of type (exn i/o net unsupported) is raised.

Note: due to the vagaries of structure member alignment (and 32 vs. 64-bit sizes), it's not generally safe to pack raw data yourself into a blob or a SRFI-4 vector. Instead, you should treat the blob contents as a C struct. See the longer example down the page for more.

(set-socket-option S ipproto/tcp tcp/nodelay 1)
(set-socket-option S ipproto/tcp tcp/nodelay (make-string 4 #\x0))
(set-socket-option S sol/socket so/rcvlowat (u32vector->blob/shared (u32vector #x01020304)))