Re: destination port changes every time
On Thu, May 10, 2012 at 06:03:48PM +0100, abdelkader belahcene wrote:
> *Hi,
> I wrote a client/server programs, the server listen on port 5000 and
> of course the client connected on that port , I check the communication via
> the sniffex.c program from pcap (adapting something) , I noticed that
> destination port ( used by the client) is not always the same and
> completely different from the source port.
> Here is an output example:
>
> Device: lo Filter expression: ip
> Packet number 1:
> From: 127.0.0.1
> To: 127.0.0.1
> Protocol: TCP ---->The client send a request
> Src port: 49611 ---->The port is randomly choosed by
> the client ??
> Dst port: 5000
>
> Packet number 2:
> From: 127.0.0.1
> To: 127.0.0.1
> Protocol: TCP -----------> The answer from the server
> Src port: 5000
> Dst port: 49611
>
> When I stopped the client and ran it again I got another Src port from the
> client
> The question is : why the port opened by the client is not the same, and
> takes one randomly ??
That's the way TCP/IP works. Consult any handy reference, such
as TCP/IP Illustrated by W. Richard Stevens.
-dsr-
--
http://randomstring.org/~dsr/eula.html is hereby incorporated by reference.
You can't fight for freedom by taking away rights.
Reply to: