Home Java Thread Network Server Sockets

Related Tutorials


 
 

Share on Google+Share on Google+

Server Sockets

Advertisement
This page discusses - Server Sockets

Server Sockets

     

In common language we can say that the sockets are just like an end-point of two-way communication link over the network between two programs. Socket classes are used to establish a connection between client program and a server program. In java there is a java.net package, which provides two types of classes- first is ordinary socket, which implement the client side connection and second is server socket, which implement the server side connection.

In Java there are many socket class that is used for creating a Server applications. ServerSockets are quite different from normal Sockets. The main work of ServerSocket class is to wait for a request of connection by the client and connect them on published ports and then possibly returns a result to the requester. The SocketImpl is a common superclass of all classes that actually implement sockets. It is used to create both client and server sockets.


There are some constructors that might throw an
IOException under adverse conditions. Some of the constructors are as under:
ServerSocket(int port)

Creates server socket on the specified port with a queue length of 50.

ServerSocket(int port, int maxQueue)

Creates a server socket on the specified port with a maximum queue length of maxQueue.

ServerSocket(int port, int maxQueue, InetAddress localAddress)

Creates a server socket on the specified port with a maximum queue length of maxQueue. On a multihomed host, localAddress specifies the IP address to which this socket binds.

  

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 17, 2011

Related Tutorials

Discuss: Server Sockets  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com