Server Sockets
by , 04-25-2012 at 10:19 PM (325 Views)
One common question which arises in mind is that who listens at the socket’s other end. Answer to this question is nobody unless server socket is set or pre existing service has been connected and an attempt to make connection would be failed. Principal constructor is :
that makes a server socket which listen at specific port. To make a connection or set server socket, use this code:Java Code:ServerSocket(int port)
Server socket known as sSoc is created and then its accept() method is called. Here, code would be waiting till other process makes a connection with server socket by making an automatic client socket.Java Code:import java.net.*; SeverSocket sSoc = new ServerSocket(1024); Socket in = sSoc.accept();









Email Blog Entry
sorry for all the questions
thanks...
06-14-2013, 02:22 PM in gbonecapone