Win a copy of Kotlin in Action this week in the Kotlin forum!
    Bookmark Topic Watch Topic
  • New Topic

Cant understand the example...(URGENT)  RSS feed

 
Gaurav Jain
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Report post to moderator
I was going through an example on socket programming with multi threading.
It has a socket server with multi threading implemented in it.
I fail to understand the following:
1. A listener port is opened on the server say 8888 where the server listens to the incoming requests,from which port does it send the response back to the client? Is it from the same listener port or does it open any other free port to send the response?
2.The example does not open any port explicitly on the client machine,so from which port does the client receive and send the requests?
3.I understand that the server is capable of handling multiple requests because of multithreadig although i cannot understand that how the requests and corrosponding responses are mapped that is how is the manupilation done that client receive the response to their request and not somebody elses response and who does this manupilation?
Basically i need to understand that whats going on behind the scenes for all these activities.
Will appreciate a detailed answer.
The example in question can be found at http://java.sun.com/docs/books/tutorial/networking/index.html.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same query to multiple forums. Because this is mostly about sockets, I'm going to close this one and leave the one over there open.
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!