Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
I'm getting the length of the packet, how do I get the IP address from where the packet comes from?

printf( "length of packet: %d\n", packetHeader->len ); } 
Posted
Comments
Joan M 21-Apr-11 15:29pm    
A bit more of information would give us the possibility to help...

I believe that the socket object knows the ip it's connected to. Of course, you gave almost no information, so I'm only guessing that your using the CSocket class.
 
Share this answer
 
Comments
Member 7766180 21-Apr-11 16:14pm    
Its WinPcap. And Here is the code...

(I deleted the code because it's impossible to read. JSOP)
Indivara 21-Apr-11 17:25pm    
Please update your question, this is impossible to read
Member 7766180 21-Apr-11 17:36pm    
See the link posted in Solution 2, I agree, its impossible!
DS
I believe you are using a 3rd party lib here? If so you need to look up their documentation. If you can mention the name of the library perhaps someone may be able to help you.
 
Share this answer
 
Comments
Member 7766180 21-Apr-11 16:16pm    
Its a WinPcap driver. Here is the Link, on this site (2nd block), the code is above but its kinda jumbled.
http://www.codeproject.com/KB/IP/winpcap_basic.aspx
Nish Nishant 21-Apr-11 16:22pm    
I think it would be best to post a question in the forum under that specific article.
Member 7766180 21-Apr-11 17:09pm    
Forum is empty. Old link as well. Any help is appreciated.
Thanks
DS

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900