Tutorial :Source IP from UDP packet in c under window OS



Question:

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.


Solution:1

Use the recvfrom function. It has a from parameter that points to a sockaddr structure that will receive the source address.


Solution:2

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


Solution:3

recvfrom is what you need


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »