One thing which is stumping me is this: every time an FTP client
sends a data request to the server, it has to be preceded by a Port
number. Now looking at the output 'ftp -d' I cannot help but notice
that every request is accompanied by a different ( and apparently
arbitrary ) port number. So my question is how does the client allocate
this port number. I presume that it makes calls to the OS which
allocates unique unreserved port numbers available at the time. Is that
correct? If so what are the calls and how are they made to:
1) Unix
2) Win95
I tried to look up Stevens Vol I as that is touted as the Bible of
TCP/IP networking in this forum. But there was no clear answer to this
question in the FTP chapter.
Thanks
Chetan
PS. I will much appreciate an email response. Please remove
the dashes from my email address before sending email. Thanks
When using the sockets API (in most Unix and Windows systems), the
application calls bind(), passing in a sockaddr_in structure whose port
field contains IPPORT_ANY. This requests the OS to assign an unused port
when binding the socket. The application can then call getsockname() to
get the port number that was assigned.
--
Barry Margolin, bar...@bbnplanet.com
BBN Corporation, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>