Meaningless Drivel is fun!*
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 Android Security Essentials Live Lessons this week in the Android 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: 19655

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
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Doubt in ServerSocket and Socket
Similar Threads
applet loading forever...
Objects to capture!!
Client Server Communication
sockets and printwriting
not able to connect...