Skip to main content
SIO_APPLY_TRANSPORT_SETTING control code

The SIO_APPLY_TRANSPORT_SETTING control code applies one or more transport settings to a socket.

To perform this operation, call the WSAIoctl or WSPIoctl function with the following parameters.


int WSAIoctl(
  (socket) s,             // descriptor identifying a socket
  SIO_APPLY_TRANSPORT_SETTING, // dwIoControlCode
  (LPVOID) lpvInBuffer,  // pointer to the input buffer 
  (DWORD) cbInBuffer,    // size, in bytes, of the input buffer
  (LPVOID) lpvOutBuffer,             // pointer to the output buffer
  (DWORD) cbOutBuffer,   // size, in bytes, of the output buffer
  (LPDWORD) lpcbBytesReturned,    // number of bytes returned
  (LPWSAOVERLAPPED) lpOverlapped,   // OVERLAPPED structure
  (LPWSAOVERLAPPED_COMPLETION_ROUTINE) lpCompletionRoutine,  // completion routine
);

int WSPIoctl(
  (socket) s,             // descriptor identifying a socket
  SIO_APPLY_TRANSPORT_SETTING, // dwIoControlCode
  (LPVOID) lpvInBuffer,  // pointer to the input buffer
  (DWORD) cbInBuffer,    // size, in bytes, of the input buffer
  (LPVOID) lpvOutBuffer,             // pointer to the output buffer
  (DWORD) cbOutBuffer,   // size, in bytes, of the output buffer
  (LPDWORD) lpcbBytesReturned,    // number of bytes returned
  (LPWSAOVERLAPPED) lpOverlapped,   // OVERLAPPED structure
  (LPWSAOVERLAPPED_COMPLETION_ROUTINE) lpCompletionRoutine,  // completion routine
  (LPWSATHREADID) lpThreadId,   // a WSATHREADID structure 
  (LPINT) lpErrno   // a pointer to the error code.
);

Parameters

s

A descriptor identifying a socket.

dwIoControlCode

The control code for the operation. Use SIO_APPLY_TRANSPORT_SETTING for this operation.

lpvInBuffer

A pointer to the input buffer. This parameter contains a pointer to a structure where the first member of the structure is a TRANSPORT_SETTING_ID stucture that determines what transport setting is being applied.

cbInBuffer

The size, in bytes, of the input buffer. This parameter depends on the transport setting being applied.

lpvOutBuffer

A pointer to the output buffer. This parameter depends on the transport setting being applied.

cbOutBuffer

The size, in bytes, of the output buffer.

lpcbBytesReturned

A pointer to a variable that receives the size, in bytes, of the data stored in the output buffer.

If the output buffer is too small, the call fails, WSAGetLastError returns WSAEINVAL, and the lpcbBytesReturned parameter points to a DWORD value of zero.

If lpOverlapped is NULL, the DWORD value pointed to by the lpcbBytesReturned parameter that is returned on a successful call cannot be zero.

If the lpOverlapped parameter is not NULL for overlapped sockets, operations that cannot be completed immediately will be initiated, and completion will be indicated at a later time. The DWORD value pointed to by the lpcbBytesReturned parameter that is returned may be zero since the size of the data stored can't be determined until the overlapped operation has completed. The final completion status can be retrieved when the appropriate completion method is signaled when the operation has completed.

lpvOverlapped

A pointer to a WSAOVERLAPPED structure.

If socket s was created without the overlapped attribute, the lpOverlapped parameter is ignored.

If s was opened with the overlapped attribute and the lpOverlapped parameter is not NULL, the operation is performed as an overlapped (asynchronous) operation. In this case, lpOverlapped parameter must point to a valid WSAOVERLAPPED structure.

For overlapped operations, the WSAIoctl or WSPIoctl function returns immediately, and the appropriate completion method is signaled when the operation has been completed. Otherwise, the function does not return until the operation has been completed or an error occurs.

lpCompletionRoutine

A pointer to the completion routine called when the operation has been completed (ignored for non-overlapped sockets).

lpThreadId

A pointer to a WSATHREADID structure to be used by the provider in a subsequent call to WPUQueueApc. The provider should store the referenced WSATHREADID structure (not the pointer to same) until after the WPUQueueApc function returns.

Note  This parameter applies only to the WSPIoctl function.

lpErrno

A pointer to the error code.

Note  This parameter applies only to the WSPIoctl function.

Return value

If the operation completes successfully, the WSAIoctl or WSPIoctl function returns zero.

If the operation fails or is pending, the WSAIoctl or WSPIoctl function returns SOCKET_ERROR. To get extended error information, call WSAGetLastError.

Error codeMeaning
WSA_IO_PENDING

Overlapped I/O operation is in progress. This value is returned if an overlapped operation was successfully initiated and completion will be indicated at a later time.

WSA_OPERATION_ABORTED

The I/O operation has been aborted because of either a thread exit or an application request. This error is returned if an overlapped operation was canceled due to the closure of the socket or the execution of the SIO_FLUSH IOCTL command.

WSAEFAULT

The system detected an invalid pointer address in attempting to use a pointer argument in a call. This error is returned of the lpvInBuffer, lpvoutBuffer, lpcbBytesReturned, lpOverlapped or lpCompletionRoutine parameter is not totally contained in a valid part of the user address space.

WSAEINPROGRESS

A blocking operation is currently executing. This error is returned if the function is invoked when a callback is in progress.

WSAEINTR

A blocking operation was interrupted by a call to WSACancelBlockingCall. This error is returned if a blocking operation was interrupted.

WSAEINVAL

An invalid argument was supplied. This error is returned if the dwIoControlCode parameter is not a valid command, or a specified input parameter is not acceptable, or the command is not applicable to the type of socket specified.

WSAENETDOWN

A socket operation encountered a dead network. This error is returned if the network subsystem has failed.

WSAENOTSOCK

An operation was attempted on something that is not a socket. This error is returned if the descriptor s is not a socket.

WSAEOPNOTSUPP

The attempted operation is not supported for the type of object referenced. This error is returned if the specified IOCTL command is not supported. This error is also returned if the SIO_APPLY_TRANSPORT_SETTING IOCTL is not supported by the transport provider. This error is also returned when an attempt to use the SIO_APPLY_TRANSPORT_SETTING IOCTL is made on a socket other than a TCP socket.

 

Remarks

The SIO_APPLY_TRANSPORT_SETTING IOCTL is supported on Windows 8, and Windows Server 2012, and later versions of the operating system.

The SIO_APPLY_TRANSPORT_SETTING IOCTL is a generic IOCTL used to apply transport setting to socket. The transport setting being applied is based on the TRANSPORT_SETTING_ID passed in the lpvInBuffer parameter.

The only transport setting currently defines is for the REAL_TIME_NOTIFICATION_CAPABILITY capability on a TCP socket.

If the TRANSPORT_SETTING_ID passed in the lpvInBuffer parameter has the Guid member set to REAL_TIME_NOTIFICATION_CAPABILITY, then this is a request to apply real time notification settings for the TCP socket used with the ControlChannelTrigger to receive background network notifications in a Windows Store app. The lpvInBuffer parameter should point to a REAL_TIME_NOTIFICATION_SETTING_INPUT structure. The lpvOutBuffer parameter is unused for this operation. This transport setting applies only to TCP sockets. This transport setting provides a way for WinInet or similar network services to mark a given TCP socket as ControlChannelTrigger enabled. Windows will mark the corresponding TCP socket and configure appropriate hardware and software settings when this option is called. A Windows Store app will not call this IOCTL directly.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Mstcpip.h

See also

ControlChannelTrigger
REAL_TIME_NOTIFICATION_SETTING_INPUT
socket
SIO_QUERY_TRANSPORT_SETTING
TRANSPORT_SETTING_ID
WSAGetLastError
WSAGetOverlappedResult
WSAIoctl
WSAOVERLAPPED
WSASocket
WSPIoctl