• Post Reply Bookmark Topic Watch Topic
  • New Topic

Client info on the Server Side  RSS feed

 
Clover Rose
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to ask that, when a server listen to A port and it accepts a request from a client then
the server accepts the request using accept method,but how does the server get the info about the client like wat is the port no and ip address of the client,I read a answer regarding this that
Server never gets the port no of client only the ip address and it connects to client using a connection stream but as far I know from networking, a device must have the ip address and port no of the device it wants to connect to,kindly help me clarify this doubt and put more light on how exactly the server gets details about client.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch. The accept method returns a java.net.Socket object; read its javadocs to find out all the information the server can get from that.
 
Clover Rose
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the API docs relating to Serversocket would be more relevant in this matter,and I looked that too,I just want to clarify does the server needs the
Client port no and ip address both for connecting to it and if yes how does it get the required ip address and port no of client,is it the getinetaddress method through which server gets the ip address of client and if yes how to get port no of client
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think the API docs relating to Serversocket would be more relevant

Actually, no. Have you read the Socket javadocs as I suggested?
 
Clover Rose
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok now as I looked it more carefully I got all my answers there(till now I was looking in wrong section I.e the Serversocket),thankyou for taking out time to answer my queries and guiding me
towards the answer .
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!