WSHSetSocketInformation

INT
WSHSetSocketInformation(
IN PVOID HelperDllSocketContext,
IN SOCKET SocketHandle,
IN HANDLE TdiAddressObjectHandle,
IN HANDLE TdiConnectionObjectHandle,
IN INT Level,
IN INT OptionName,
IN PCHAR OptionValue,
IN INT OptionLength
);

WSHSetSocketInformation is called by the Windows Sockets DLL whenever an application calls setsockopt with an option that Windows Sockets does not explicitly handle.

Parameter

HelperDllSocketContext

Points to a per-socket context area, allocated and initialized by the WSH DLL WSHOpenSocket or WSHOpenSocket2 function.

SocketHandle

Specifies the handle of the socket returned by socket or accept.

TdiAddressObjectHandle

Specifies the handle to a file object representing the open transport address for the socket. If the socket is not currently bound to an address, this parameter is NULL.

TdiConnectionObjectHandle

Specifies the handle to a file object representing the connection endpoint associated with the socket. If the socket is not currently connected, this parameter is NULL.

Level

Specifies the level passed in the setsockopt call.

OptionName

Specifies the optname passed in the setsockopt call.

OptionValue

Points to a buffer passed as the optval argument to setsockopt. This buffer contains caller-supplied data for the set operation.

OptionLength

Specifies the size in bytes of the buffer at OptionValue.

Return Value

WSHSetSocketInformation returns zero if it successfully interprets the given option and carries out whatever operation it requires. Otherwise it returns a Windows Sockets error code. If the return value is nonzero, the setsockopt call fails and the error is set to the value returned by WSHSetSocketInformation.

Comments

WSHSetSocketInformation can provide support for arbitrary options beyond those defined by Windows Sockets. Certain defined options also are passed to the helper DLL because of the different ways in which transport drivers provide support for these options, in particular for the SO_KEEPALIVE and SO_DONTROUTE options.

Any option passed in an application call to setsockopt that the Windows Sockets DLL does not explicitly support is forwarded to WSHSetSocketInformation. The Windows Sockets DLL relies on each helper DLL to fail calls for which the given option is invalid or unsupported by the helper DLL or underlying transport.

See Also

WSHGetSocketInformation