• Post Reply Bookmark Topic Watch Topic
  • New Topic

Socket-port relationship....  RSS feed

 
pal kandy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<pre>
hi all,
i've a very basic doubt -
one port is associated with only one unique socket object or it can be associated with multiple socket/serversocket objects?
any help will be greatly appreciated.
Thanx.
Nitin
</pre>
 
Lewin Chan
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My understanding of tcp/ip is a bit flaky, but when you do a ServerSocket.accept() and create a new Socket object, that is attached to the client using an arbitary port that isn't in use.
Similarly, when you initiate a socket connection using Socket.connect(), you attempt to connect to the specified port on the server, but your *actual* local port is some arbitary port that isn't being used.
that probably doesn't even answer your question...
 
pal kandy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<pre>
hi lewin,
when serversocket.accept() returns a socket object on receiving a client request, the new socket object is associated with a port on server side.now my doubt is that this port is the same one with which the serversocket object is associated. so same port linked to serversocket & the new socket object. this gives rise to conflict in my mind - how the data- which consists of client requests for serversocket & data for the new socket object - will be separated as both socket objects have same port associated with them. OR
these two r totally different connections that's why sockets can be associated with same numbered port, i wonder.
:roll:
Regards,
Nitin
</pre>
 
ersin eser
Ranch Hand
Posts: 1072
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi pal75
Thanks for hanging around but would you kindly read our naming rules and re-register ?
Thanks !
 
pal kandy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok. i've changed my register name from pal75 to pal k. i hope that satisfies the requirements of naming policy used here.
Regards,
pal
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!