Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in ServerSocket and Socket  RSS feed

 
Abhijit Das
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

what is the difference between the the Socket object created by client side as



and the Socket object created in the Server side as


Next, should I use the sockets reversely ?
 
Rob Spoor
Sheriff
Posts: 20968
84
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A socket has two end points - one on the client and one on the server, even if the client and server are on the same physical machine.

The first call creates the end point on the client side. ServerSocket.accept returns the end point on the server side. They are two different objects, but linked through the network.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!