On Tue, 22 Oct 2002, Marc G. Fournier wrote:

> Just a quick question ... how does the OS determine the 'source port' when
> connecting to a remote site?

The OS picks one from a pool of ports, unless told to use one
explicitly. These are called ephemeral ports.

> is it reasonably safe to assume that the lower of the two ports is
> the dest port?

This seems dubious, at best.  It is easy to exactly determine what the
ports involved are, rather than coming up with a heuristic.  Check out
'netstat -a' or 'lsof'.

> for instance, if I try to telnet to a remote site where the remote
> site is running a service on port 6667, is it a pretty safe bet that
> FreeBSD will pick a port >6667 to go out on?  or is there an equal
> chance of it being lower?

In general, it will be greater than 6667 (32000+), but not guaranteed.
If the applications chooses to bind(2) to a port, it could be almost
anything.

I think this question is better suited for freebsd-questions than
freebsd-net.  I would also recommend picking up a tutorial on TCP/IP.

Thanks,

-James

-- 
James Pace <[EMAIL PROTECTED]>


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-net" in the body of the message

Reply via email to