com.epam.common.transport.server.tcp
Class TCPServer

java.lang.Object
  extended by com.epam.common.transport.server.tcp.TCPServer
All Implemented Interfaces:
Server
Direct Known Subclasses:
SSLTCPServer

public class TCPServer
extends Object
implements Server

TCP server implementation.


Constructor Summary
TCPServer()
          Creates server with default port.
TCPServer(int port)
          Creates server.
TCPServer(int port, boolean enableNagle)
          Creates server.
TCPServer(int port, boolean enableNagle, String nic)
          Creates server.
 
Method Summary
 void setIncomingConnectionListener(ConnectionListener listener)
          Sets the connection listener.
 void setPort(int port)
          Sets port.
 void setServerSocketFactory(ServerSocketFactory serverSocketFactory)
          Sets server socket factory.
 void start()
          Start the server.
 void stop()
          Stop server.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TCPServer

public TCPServer()
Creates server with default port. The default value for port is 3001


TCPServer

public TCPServer(int port)
Creates server.

Parameters:
port - - server port

TCPServer

public TCPServer(int port,
                 boolean enableNagle)
Creates server.

Parameters:
port - - server port
enableNagle - - enable/disable nagle algorithm

TCPServer

public TCPServer(int port,
                 boolean enableNagle,
                 String nic)
Creates server.

Parameters:
port - - server port
enableNagle - - enable/disable nagle algorithm
nic - - specific connection address
Method Detail

setServerSocketFactory

public void setServerSocketFactory(ServerSocketFactory serverSocketFactory)
Sets server socket factory. User can replace default socket factory with own implementation.

Parameters:
serverSocketFactory - - socket factory

setPort

public void setPort(int port)
Sets port.

Parameters:
port -

setIncomingConnectionListener

public void setIncomingConnectionListener(ConnectionListener listener)
Description copied from interface: Server
Sets the connection listener.

Specified by:
setIncomingConnectionListener in interface Server
Parameters:
listener - the connection listener
See Also:
Server.setIncomingConnectionListener(com.epam.common.transport.server.ConnectionListener)

start

public void start()
           throws IOException
Description copied from interface: Server
Start the server.

Specified by:
start in interface Server
Throws:
IOException - - if error occurred
See Also:
Server.start()

stop

public void stop()
          throws IOException
Description copied from interface: Server
Stop server.

Specified by:
stop in interface Server
Throws:
IOException - - if error occurred
See Also:
Server.stop()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2014 EPAM Systems. All Rights Reserved.