How do I get the original IP address from the IP header of a datagram using Winsock?
1 answer
I don't think you can get it if you use standard recv or read function calls. Calling recvfrom like this:
int recvfrom(
__in SOCKET s,
__out char *buf,
__in int len,
__in int flags,
__out struct sockaddr *from,
__inout_opt int *fromlen
);
includes a structure (second to the last field above) that will get the source address, which you can explore for whatever purposes you want.
+4
source to share