getsockopt (Windows Sockets)
A version of this page is also available for
This function retrieves a socket option.
int getsockopt( SOCKET s, int level, int optname, char FAR* optval, int FAR* optlen );
[in] Descriptor identifying a socket.
[in] Level at which the option is defined; the supported levels include:
[in] Socket option for which the value is to be retrieved.
[out] Pointer to the buffer in which the value for the requested option is to be returned.
[in, out] Pointer to the size of the optval buffer.
If no error occurs, this function returns zero. If an error occurs, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
The following table shows the possible error codes.
A successful WSAStartup call must occur before using this function.
The network subsystem has failed.
One of the optval or optlen parameters is not a valid part of the user address space, or the optlen parameter is too small.
A blocking Winsock call is in progress, or the service provider is still processing a callback function.
The level parameter is unknown or invalid.
The option is unknown or unsupported by the indicated protocol family.
The descriptor is not a socket.
This function retrieves the current value for a socket option associated with a socket of any type, in any state, and stores the result in optval. Options can exist at multiple protocol levels, but they are always present at the uppermost socket level. Options affect socket operations, such as the packet routing and out of band (OOB) data transfer.
The value associated with the selected option is returned in the buffer optval. The integer pointed to by optlen should originally contain the size of this buffer; on return, it will be set to the size of the value returned. For SO_LINGER, this will be the size of a linger structure. For most other options, it will be the size of an integer.
The application is responsible for allocating any memory space pointed to directly or indirectly by any of the parameters it specified.
If the option was never set with setsockopt (Windows Sockets), then getsockopt returns the default value for the option.
To view SOL_SOCKET options that are are supported for getsockopt, see SOL_SOCKET.
To view IPPROTO_TCP options that are are supported for getsockopt, see IPPROTO_TCP.
To view IPPROTO_IP options that are are supported for getsockopt, see IPPROTO_IP.
To view IPPROTO_IPv6 options that are are supported for getsockopt, see IPPROTO_IPV6.
To view IPPROTO_RAW options that are are supported for getsockopt, see Windows Mobile topic IPPROTO_RAW.
To view SOL_IRLMP options that are are supported for getsockopt, see SOL_IRLMP.
Windows Embedded CE does not support Internetwork Packet Exchange (IPX).
The following list shows BSD options that are not supported in Windows Embedded CE for getsockopt
Calling getsockopt with an unsupported option will result in an error code of WSAENOPROTOOPT being returned from WSAGetLastError.
Notes for IrDA Sockets
- The Af_irda.h header file must be explicitly included.
- Windows NT® and Windows 2000 will return WSAENETDOWN to indicate the underlying transceiver driver failed to initialize with the IrDA protocol stack.
- IrDA supports special socket options. For more information about these socket options, see SOL_IRLMP.
- Many SO level socket options are not meaningful to IrDA; only SO_LINGER and SO_DONTLINGER are specifically supported.
For more inforamtion about IrDA support in Windows Embedded CE, see Infrared Communications.
|Windows Embedded CE||Windows CE 1.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|
bind (Windows Sockets)
setsockopt (Windows Sockets)
socket (Windows Sockets)