![]() |
|
| << Previous | Index | Next >> | |
| | |
int udp_recvfrom( udp_Socket *s, char *buffer, int len,
longword *remip, word *remport );Description
Receive a single UDP datagram on a UDP socket. remip and remport should be pointers to the locations where the remote IP address and remote port from which the datagram originated are placed. If the buffer is not large enough for the datagram, then the datagram will be truncated, with the remainder being discarded.
If and only if the
UDP_MODE_ICMPorUDP_MODE_DICMPmodes are set for this socket, then a return code of -3 indicates that an ICMP error message is being returned in the buffer instead of a normal datagram. In this case,bufferwill contain fixed data in the form of a structure of type_udp_icmp_message. The definition of this structure is:typedef struct {
word myport; // Originating port on this host
byte icmp_type; // One of the ICMPTYPE_* values
byte icmp_code; // The corresponding ICMP code
} _udp_icmp_message;Please see
sock_modefor more information about the modesUDP_MODE_ICMPandUDP_MODE_DICMP.Parameters
s
- Pointer to socket's data structure.
buffer
- Buffer where the UDP datagram will be stored.
len
- Maximum length of the buffer.
remip
- IP address of the remote host of the received datagram.
remport
- Port number of the remote host of the received datagram.
Return value
- ≥
0: Number of bytes received.-1: No datagram waiting.-2: Error - not a UDP socket.-3: The returned buffer contains an ICMP error which was queued previously.Library
UDP.LIB
See also
| TCP/IP Manual Vol 1 |
<<Previous | Index | Next>> | rabbit.com |