recvfrom The recvfrom function receives a datagram and stores the source address.int recvfrom( SOCKET s, char FAR* buf, int len, int flags, struct sockaddr FAR *from, int FAR *fromlen );Parameters s [in] Descriptor identifying a bound socket. buf [out] Buffer for the incoming data. len [in] Length of buf. flags [in] Indicator specifying the way in which the call is made. from [out] Optional pointer to a buffer that will hold the source address upon return. fromlen [in, out] Optional pointer to the size of the from buffer.
The recvfrom function receives a datagram and stores the source address.int recvfrom(
SOCKET s,
char FAR* buf,
int len,
int flags,
struct sockaddr FAR *from,
int FAR *fromlen
);Parameters
s
[in] Descriptor identifying a bound socket.
buf
[out] Buffer for the incoming data.
len
[in] Length of buf.
flags
[in] Indicator specifying the way in which the call is made.
from
[out] Optional pointer to a buffer that will hold the source address upon return.
fromlen
[in, out] Optional pointer to the size of the from buffer.
sprintf(szip,"%s",inet_addr(sockaddr.sin_addr));int nport = sockaddr.sin_port;