send / sendto TCP UDP
Copy bytes from an application memory buffer into a socket to send to a remote socket. See function NetSock_TxData() for more information.
Files
net_bsd.h/net_bsd.c
Prototypes
ssize_t send (int sock_id, void *p_data, _size_t data_len, int flags); ssize_t sendto ( int sock_id, void *p_data, _size_t data_len, int flags, struct sockaddr *p_addr_remote, socklen_t addr_len);
Arguments
sock_id
Socket descriptor/handle identifier of socket to send data.
p_data
Pointer to application data to send.
data_len
Length of application data to send (in octets).
flags
Flags to select send options; bit-field flags logically OR'd:
0, No socket flags selected.
MSG_DONTWAIT, Send socket data without blocking.
p_addr_remote
Pointer to the destination address buffer; required for datagram sockets, optional for stream sockets.
addr_len
Length of destination address buffer (in octets).
Returned Value
The number of positive data octets sent if no error(s).
0, if socket connection closed.
-1, otherwise.