I want to get the source IP of UDP packet kindly guide me so that I can make it possible. I am working in c under windows platform.
+1
A:
EDIT:
have a look at this tutorial: http://www.sockets.com/ch16.htm
There you should find some code that can guide you in the right direction!
This should help you:
sockaddr structure:
http://msdn.microsoft.com/en-us/library/ms740496(VS.85).aspx
in_addr structure:
http://msdn.microsoft.com/en-us/library/ms738571(VS.85).aspx
Tony
2010-07-19 12:10:20
+2
A:
Use the recvfrom function. It has a from
parameter that points to a sockaddr structure that will receive the source address.
Marcelo Cantos
2010-07-19 12:10:55
Actually my application is in sniffer mode, so that I can't use the recvfrom function.
Arman
2010-07-19 12:13:10
What does that mean - what API are you using for sniffing ?
nos
2010-07-19 12:23:13
I am using winsock.
Arman
2010-07-19 12:25:47
@Arman, wait, so what's the matter with the recvfrom in your case? I believe that the link in the post you marked as an answer also suggests using the function
ULysses
2010-07-19 14:26:27
@ULysses, now Ok??
Arman
2010-07-20 04:09:16
@Arman, :) yepp
ULysses
2010-07-20 09:03:52