Specifies the mechanism used to access the ioctlsocket() API for the platform or operating system hosting the Indy library.
function IOControl( const s: TIdStackSocketHandle; const cmd: cardinal; var arg: cardinal ): Integer; virtual; abstract;
Parameters |
Description |
s |
Sokcet handle for the operation. |
cmd |
ioctlsocket command for the operation. |
arg |
Arguments for the operation. |
Integer - 0 on success, or the socket error from the protocol stack.
IOControl is an abstract virtual method that specifies the mechanism used to access the ioctlsocket() API for the platform or operating system hosting the Indy library.
IOControl is used to set or retrieve operating parameters associated with the socket, independent of the protocol and communications subsystem. The following are the values and semantics supported in the cmd argument to the method:
Command |
Argument and values |
FIONBIO |
Unsigned long value. Pass a nonzero value if the |
|
nonblocking socket mode should be enabled, or 0 (zero) |
|
if noblocking is disabled. |
FIONREAD |
Used to determine the amount of data pending in the |
|
network's input buffer that can be read from the socket. |
|
The argp parameter points to an unsigned long value in |
|
which ioctlsocket stores the result. FIONREAD returns the |
|
amount of data that can be read in a single call to the |
|
recv function, which may not be the same as the total |
|
amount of data queued on the socket. If socket handle in s |
|
is message oriented (for example, type SOCK_DGRAM), |
|
FIONREAD still returns the amount of pending data in the |
|
network buffer, however, the amount that can actually be |
|
read in a single call to the recv function is limited to |
| |
SIOCATMARK |
Used to determine if all out of band (OOB) data has been |
|
read. (See Windows Sockets 1.1 Blocking Routines and |
|
EINPROGRESS for a discussion on OOB data.) This applies |
|
only to a stream oriented socket (for example, type |
|
SOCK_STREAM) that has been configured for in-line |
|
reception of any OOB data (SO_OOBINLINE). On sockets with |
|
the SO_OOBINLINE socket option set, SIOCATMARK always |
|
returns TRUE and the OOB data is returned to the user as |
|
normal data. |
Please note that some of the cmd values are not relevant for use in the Indy library; specifically, asynchronous socket operations specified using FIONBIO are not supported.
In addition, IOControl performs only a subset of functions on a socket when compared to the ioctl function found in Berkeley sockets. The ioctlsocket function has no command parameter equivalent to the FIOASYNC of ioctl, and SIOCATMARK is the only socket-level command that is supported by ioctlsocket.
Return values for the IOControl method including the following values and meanings:
Upon successful completion, the ioctlsocket returns zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
Value |
Meaning |
0 |
Successful completion. |
WSANOTINITIALISED |
A successful WSAStartup call must occur before using this function. |
WSAENETDOWN |
The network subsystem has failed. |
WSAEINPROGRESS |
A blocking socket call is in progress, or the service provider is still processing a callback function. |
WSAENOTSOCK |
The socket descriptor is not a valid socket handle. |
WSAEFAULT |
The argument parameter is not a valid part of the user address space. |
IOControl must be overridden and implemented in a descendant class that provides access to the protocol stack implementation for the platform or operating system hosting the Indy library.
Internet Direct (Indy) version 10.1.5
Copyright © 1993-2006, Chad Z. Hower (aka Kudzu) and the Indy Pit Crew. All rights reserved. Website http://www.indyproject.org. Post feedback to the Indy Documentation newsgroup. |