A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Sockets and Internet Protocols
Doubt in ServerSocket and Socket
Joined: Sep 25, 2007
Dec 05, 2008 02:30:00
what is the difference between the the Socket object created by client side as
Socket socketClient = new Socket("localhost",4444);
and the Socket object created in the Server side as
ServerSocket serverSocket = new ServerSocket(4444); socket socketServ = serverSocket.accept();
Next, should I use the sockets reversely ?
SCJP 5.0 | SCWCD 1.5
Joined: Oct 27, 2005
Dec 05, 2008 03:23:00
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.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions
How To Answer Questions
It is sorta covered in the
JavaRanch Style Guide
subject: Doubt in ServerSocket and Socket
Client Server Communication
not able to connect...
Objects to capture!!
applet loading forever...
sockets and printwriting
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014