chickadee » socket » get-socket-option

get-socket-option s level name #!optional (len #f)procedure

Get the value of option name at socket level level on socket s. If len is #f, the default, we interpret the option value as an integer and return that. Otherwise, temporary storage of length len is allocated to receive the binary option data; after the call it is resized to fit the data, and returned. If len is too small to hold the returned data, the result is undefined.

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

This procedure does not convert integers to boolean values---if you expect a boolean flag, assume zero means #f and non-zero means #t. Don't be surprised if boolean flags return different non-zero integer values from those you put in; that's an implementation detail. You can only rely on true being some non-zero value.

(get-socket-option S ipproto/tcp tcp/nodelay)     ; => 8, perhaps, meaning #t
(get-socket-option S ipproto/tcp tcp/nodelay 64)  ; => #${08000000}
(get-socket-option S ipproto/tcp tcp/nodelay 4)   ; => #${08000000}