ioctlsocket

ioctlsocket performs a protocol-specific I/O control action on the socket in any state.

Syntax

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

Parameters

s

Open socket descriptor.

cmd

The following commands are currently supported:

Command

Description

FIONBIO

This IOCTL enables or disables nonblocking mode of a socket. By default, a socket is created in blocking mode.

FIONREAD

This IOCTL can be used with UDP and TCP sockets to determine the minimum amount of data queued in the socket receive queue that can be read with the next call to Recv or RecvFrom without blocking. More data might be available by the time Recv or RecvFrom is actually called, but at least as much as returned by the IOCTL is available. The argp parameter must point to the address of an unsigned long value. For a UDP socket, the function returns the amount of data that can be read by the next call to Recv or RecvFrom, which is the data in the UDP datagram. For a TCP socket, the amount of data in the TCP segment at the head of the socket receive queue is returned.

Note: The FIONREAD command is not supported under RTX 8.1 and earlier

SIOCATMARK

This IOCTL may be used by an application to locate the urgent byte (in any) in the incoming data stream (that is,  the byte that the sending end sent with the MSG_OOB flag). This IOCTL returns True if the next byte to be read from the read buffer is the out-of-band mark, that is:

  • Urgent data is being received inline and the next byte to be read is the urgent byte. In this case, the application can obtain the urgent byte by doing a normal read of one byte.
  • Urgent data is being received out-of-band and the next byte to be read is the first byte beyond the end of the urgent byte. In this case, the application can obtain the urgent byte by doing a read of one byte.

argp

A pointer to a parameter for cmd.

IntervalZero.com | Support | Give Feedback