• Post Reply Bookmark Topic Watch Topic
  • New Topic

accept().. (how many ports can it handle?)  RSS feed

 
Alex Joyce
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.
In preperation for an exam question I would be gratefull for the following info.

ServerSocket.accept() returns an instance of a new socket.. I got that.. but does it open a new port for every connection?.. if so how does it decide which port to use ? is there a pre defined approach (eg. it just increments the port number and if its free it uses it) if this is so.. are the number of potential simultanious connections limited to the number of free ports?.. I know this is a simple question, i would just like to get it straight..

Thanks in advance
Alex
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Alex Joyce:
but does it open a new port for every connection?.. if so how does it decide which port to use ?

That's up to the operating system to decide:
These port numbers are generally assigned in a pseudo-random manner from a reserved pool of numbers. I say �pseudo-random� because there is no specific meaning to an ephemeral port number assigned to a process, so a random one could be selected for each client process. However, since it is necessary to reuse the port numbers in this pool over time, many implementations use a set of rules to minimize the chance of confusion due to reuse.

The TCP/IP Guide


are the number of potential simultanious connections limited to the number of free ports?..

Yes.
 
Alex Joyce
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Ess:

Yes.


Thanks Joe, Appreciate it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!