On Dec 6, 2010, at 7:48 PM, 刘昆 wrote:
I have solve this problem about get ip address.However there is another question,When I print the ip address I notice there are two ip addresses I get.
Yes, there are two IP addresses in every IP packet - the source address, pinfo->src, and the destination address, pinfo->dst. pinfo->src has only one IP address, and pinfo->dot has only one IP address.I think this because there are two kinds of packet in or out.So how to judge a packet is in or out ?
What do you mean by "in" and "out"? For HTTP traffic, you usually have traffic going from the client (for example, a browser) to the server, and traffic going from the server to the client. You would have to look at whether the packet is an HTTP request (which goes from the client to the server) or an HTTP reply (which goes from the server to the client) to determine in which direction the packet is going. |