aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes Doubt in ServerSocket and Socket Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Doubt in ServerSocket and Socket " Watch "Doubt in ServerSocket and Socket " New topic

Doubt in ServerSocket and Socket

Abhijit Das
Ranch Hand

Joined: Sep 25, 2007
Posts: 156

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 ?

Abhijit Das
SCJP 5.0 | SCWCD 1.5
Rob Spoor

Joined: Oct 27, 2005
Posts: 19847

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.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: Doubt in ServerSocket and Socket