Microsoft Windows CE 3.0  

ioctlsocket

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

This function controls the mode of a socket.

int
ioctlsocket
(
SOCKET
s
,
long
cmd
,
u_long
*
argp
);

Parameters

s
[in] Descriptor that identifies a socket.
cmd
[in] Command to perform on the socket s.
argp
[in/out] Pointer to a parameter for cmd.

Return Values

Zero indicates success. SOCKET_ERROR indicates failure. To get a specific error value, call WSAGetLastError.

Remarks

The ioctlsocketfunction can be used on any socket in any state. It is used to set or retrieve operating parameters associated with the socket, independent of the protocol and communications subsystem. Here are the supported commands to use in the cmdparameter and their semantics:

FIONBIO
Use with a nonzero argpparameter to enable the nonblocking mode of socket s. The argpparameter is zero if nonblocking is to be disabled. The argpparameter points to an unsigned long value. When a socket is created, it operates in blocking mode by default (nonblocking mode is disabled). This is consistent with BSD sockets.
FIONREAD
Use to determine the amount of data pending in the network's input buffer that can be read from socket s. The argpparameter points to an unsigned long value in which ioctlsocketstores the result. If sis stream oriented (for example, type SOCK_STREAM), FIONREAD returns the amount of data that can be read in a single call to the recvfunction; this might not be the same as the total amount of data queued on the socket. If sis message oriented (for example, type SOCK_DGRAM), FIONREAD returns the size of the first datagram (message) queued on the socket.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winsock.h    
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

getsockopt, socket, setsockopt, WSAStartup