Nut/Net supports connectionless UDP sockets only.
Functions | |
UDPSOCKET * | NutUdpCreateSocket (u_short port) |
Create a UDP socket. | |
int | NutUdpDestroySocket (UDPSOCKET *sock) |
Close UDP socket. | |
UDPSOCKET * | NutUdpFindSocket (u_short port) |
Find a matching socket. | |
int | NutUdpGetSockOpt (UDPSOCKET *sock, int optname, void *optval, int optlen) |
Get a UDP socket option value. | |
int | NutUdpReceiveFrom (UDPSOCKET *sock, u_long *addr, u_short *port, void *data, u_short size, u_long timeout) |
Receive a UDP datagram. | |
int | NutUdpSendTo (UDPSOCKET *sock, u_long addr, u_short port, void *data, u_short len) |
Send a UDP datagram. | |
int | NutUdpSetSockOpt (UDPSOCKET *sock, int optname, CONST void *optval, int optlen) |
Set value of a UDP socket option. | |
Variables | |
UDPSOCKET * | udpSocketList |
Create a UDP socket.
port | Server applications provide the local port number with this parameter. Client applications should pass zero. |
int NutUdpDestroySocket | ( | UDPSOCKET * | sock | ) |
Close UDP socket.
The memory occupied by the socket is immediately released after calling this function. The application must not use the socket after this call.
sock | Socket descriptor. This pointer must have been retrieved by calling NutUdpCreateSocket(). |
Find a matching socket.
Loop through all sockets and find a matching one.
port | Local port number. |
int NutUdpGetSockOpt | ( | UDPSOCKET * | sock, | |
int | optname, | |||
void * | optval, | |||
int | optlen | |||
) |
Get a UDP socket option value.
The following values can be set:
sock | Socket descriptor. This pointer must have been retrieved by calling NutUdpCreateSocket(). | |
optname | Option to get. | |
optval | Points to a buffer receiving the value. | |
optlen | Length of the value buffer. |
int NutUdpReceiveFrom | ( | UDPSOCKET * | sock, | |
u_long * | addr, | |||
u_short * | port, | |||
void * | data, | |||
u_short | size, | |||
u_long | timeout | |||
) |
Receive a UDP datagram.
sock | Socket descriptor. This pointer must have been retrieved by calling NutUdpCreateSocket(). | |
addr | IP address of the remote host in network byte order. | |
port | Remote port number in host byte order. | |
data | Pointer to the buffer that receives the data. | |
size | Size of the buffer that receives the data. | |
timeout | Maximum number of milliseconds to wait. |
Send a UDP datagram.
sock | Socket descriptor. This pointer must have been retrieved by calling NutUdpCreateSocket(). | |
addr | IP address of the remote host in network byte order. | |
port | Remote port number in host byte order. | |
data | Pointer to a buffer containing the data to send. | |
len | Number of bytes to be sent. |
int NutUdpSetSockOpt | ( | UDPSOCKET * | sock, | |
int | optname, | |||
CONST void * | optval, | |||
int | optlen | |||
) |
Set value of a UDP socket option.
The following values can be set:
sock | Socket descriptor. This pointer must have been retrieved by calling NutUdpCreateSocket(). | |
optname | Option to set. | |
optval | Pointer to the value. | |
optlen | Length of the value. |
Global linked list of all UDP sockets.