简体   繁体   中英

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是您需要的

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM