Source IP from UDP packet in c under window OS
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.
Use the recvfrom function. It has a from
parameter that points to a sockaddr structure that will receive the source address.
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
recvfrom is what you need
精彩评论