nn::socket::SendTo Function

Syntax

s32 SendTo(
     s32 s,
     const void * buf,
     s32 len,
     s32 flags,
     const SockAddrIn * sockTo
);

Arguments

Name Description
in s Specifies a socket descriptor. Specifies a socket descriptor created using the Socket or Accept function.
in buf Specifies a pointer to the buffer that is used to maintain send data.
in len Specifies the size of data to be sent in bytes.
in flags Specifies the message transmission type.
in sockTo Specifies a pointer to the socket address structure used to maintain address information about the communication target.

Return Values



Value Description
0 Process was successful.
ENETRESET Socket library is not initialized.
EBADF Invalid socket descriptor.

Description

Attempts to send data (messages) to a remote host via a socket.

This function normally blocks until there is enough free space in the send/receive buffer to store the messages, unless a non-blocking mode has been set by the Fcntl function or MSG_DONTWAIT has been specified in flags. For datagram sockets (SOCK_DGRAM), the entire message is read out in a single operation. If the message cannot fit into the allocated buffer and flags is not set to MSG_PEEK, any data that does not fit into the buffer is discarded. For stream sockets (SOCK_STREAM), message boundaries are ignored. In this case, data is returned to the user as it becomes usable.

See Also


Revision History

2010/06/14
Initial version.

CONFIDENTIAL