getsockopt()

 

SO_RCVBUF

Returns the buffer size of a socket's receive

 

 

socket buffer. The default buffer size is 4096

 

 

bytes. A stream socket's buffer size can be

 

 

increased or decreased only prior to

 

 

establishing a connection.

 

SO_SNDBUF

Returns the buffer size of a socket's send

 

 

socket buffer. The default buffer size is 4096

 

 

bytes. A stream socket's buffer size can be

 

 

increased or decreased only prior to

 

 

establishing a connection.

 

The following options are supported for •TCP" level

 

(IPPROTO_TCP) options:

 

TCP_MAXSEG

Returns the maximum segment size in use for

 

 

the socket. The value for this option can only

 

 

be examined, it cannot be set. If the socket is

 

 

not yet connected, TCP returns a default size

 

 

of 512 bytes.

 

TCP_NODELAY

(Toggle option) Instructs TCP to send data as

 

 

soon as it receives it and to bypass the

 

 

buffering algorithm that tries to avoid

 

 

numerous small packets from being sent to

 

 

the network.

optval

Byte pointer to a variable into which an option value is

 

returned. optval returns a NULL if the option information is

 

not of interest and not to be passed to the calling process.

 

Although optval is typed as (char *), the value that it

 

points to is not terminated by \0.

optlen

Pointer to a variable containing the maximum number of bytes

 

to be returned by optval.

On return, it contains the actual number of bytes returned by optval.

Berkeley Software Distribution Interprocess Communication 47