PFN_WSK_SEND callback function (wsk.h)

The WskSend function sends data over a connection-oriented or stream socket to a remote transport address.

Syntax

PFN_WSK_SEND PfnWskSend;

NTSTATUS PfnWskSend(
  [in]      PWSK_SOCKET Socket,
  [in]      PWSK_BUF Buffer,
  [in]      ULONG Flags,
  [in, out] PIRP Irp
)
{...}

Parameters

[in] Socket

A pointer to a WSK_SOCKET structure that specifies the socket object for the socket over which to send the data.

[in] Buffer

A pointer to an initialized WSK_BUF structure that describes the data buffer that contains the data that is being sent over the socket.

[in] Flags

A ULONG value that contains a bitwise OR of a combination of the following flags:

WSK_FLAG_NODELAY

Directs the underlying transport to immediately send the data, and any previously queued data, to the remote application without delay.

This flag is supported by the Microsoft TCP/IP transport protocol. This flag might not be supported by other transport protocols.

[in, out] Irp

A pointer to a caller-allocated IRP that the WSK subsystem uses to complete the send operation asynchronously. For more information about using IRPs with WSK functions, see Using IRPs with Winsock Kernel Functions.

Return value

WskSend returns one of the following NTSTATUS codes:

Return code Description
STATUS_SUCCESS
Data was successfully sent over the socket. The IRP will be completed with success status. The IoStatus.Information field of the IRP contains the number of bytes that were sent.
STATUS_PENDING
The WSK subsystem could not send the data over the socket immediately. The WSK subsystem will complete the IRP after it has sent the data over the socket. The status of the send operation will be returned in the IoStatus.Status field of the IRP. If the operation succeeds, the IoStatus.Information field of the IRP will contain the number of bytes that were sent.
STATUS_FILE_FORCED_CLOSED
The socket is no longer functional. The IRP will be completed with failure status. The WSK application must call the WskCloseSocket function to close the socket as soon as possible.
STATUS_NOT_SUPPORTED
A specified flag is not supported by the underlying network transport.
Other status codes
An error occurred. The IRP will be completed with failure status.

Remarks

A WSK application can call the WskSend function only on a connection-oriented or stream socket that has been previously connected to a remote transport address. A connection-oriented socket is connected to a remote transport address by one of the following methods:

  • The WSK application connects the socket by calling the WskConnect function.
  • The WSK application creates, binds, and connects the socket by calling the WskSocketConnect function.
  • The WSK subsystem connects the socket when the WSK application accepts an incoming connection request on a listening socket.
If the WskSend function returns STATUS_PENDING, the MDL chain that is described in the WSK_BUF structure that is pointed to by the Buffer parameter must remain locked in memory until the IRP is completed.

The WSK subsystem does not perform any buffering of data when it sends data over a socket. Therefore, a call to the WskSend function will not be completed by the WSK subsystem until all of the data has actually been sent.

Requirements

Requirement Value
Minimum supported client Available in Windows Vista and later versions of the Windows operating systems.
Target Platform Universal
Header wsk.h (include Wsk.h)
IRQL <= DISPATCH_LEVEL

See also

WSK_BUF

WSK_PROVIDER_CONNECTION_DISPATCH

WSK_PROVIDER_STREAM_DISPATCH

WSK_SOCKET

WskCloseSocket

WskReceive

WskReceiveEvent