WSASendTo

WSASendto transmits a message on a socket. This function may be used on connected or unconnected sockets.

Syntax

int WSASendTo(
    SOCKET s,
    LPWSABUF lpBuffers,
    DWORD dwBufferCount,
    LPDWORD lpNumberOfBytesSent,
    DWORD dwFlags,
    const struct sockaddr *lpTo,
    int iToLen,
    LPWSAOVERLAPPED lpOverlapped,
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine
);

Parameters

s

Socket descriptor for a connected socket.

lpBuffers

A pointer to a WSABUF structure. The WSABUF structure contains a pointer to a buffer and the length, in bytes, of the buffer.

dwBufferCount

Ignored.

lpNumberOfBytesSent

A pointer to the number of bytes sent by this call if the WSASendTo operation completes..

dwFlags

WSASendTo flags. Refer to WSASend for possible values

lpTo

An optional pointer to the address of the target socket in the SOCKADDR structure.

iToLen

The size, in bytes, of the address in the lpTo parameter.

lpOverlapped

Ignored.

lpCompletionRoutine

Ignored.

Return Value

A positive value if the function succeeds, SOCKET_EROR if the function fails

Use WSAGetLastError to retrieve a specific error code.

Requirements

Minimum Supported Version RTX64 2013
Header Winsock2.h
Library RtTcpip.lib