I have a port that is bind()'d to INADDR_ANY. I am receiving datagrams successfully. After receipt, I need to read the IP header to get the source IP address.
views:
310answers:
2
+3
A:
I don't believe you can get it if you're using the standard recv or read function calls. The recvfrom call as follows:
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 (the second to last field above) which will receive the source address which you can examine for whatever purposes you desire.
paxdiablo
2008-12-07 04:09:30
A:
won't work it is filter to receive a message not the address of coming packet
Onur Turhan
2009-11-23 14:51:31