org.simantics.databoard.method
Class Server

java.lang.Object
  extended by org.simantics.databoard.method.Server

public class Server
extends java.lang.Object

Server opens a server socket and accepts incoming connections.

Methods are invoked in read thread. Therefore method invocation blocks the whole socket. It is highly recommended that that MethodInterface implementation is non-blocking.

Author:
Toni Kalajainen

Constructor Summary
Server(int port, MethodInterface handler)
          Create new method interface server.
 
Method Summary
 void close()
          Stop listening for new connections and shutdown existing connections.
 int getPort()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Server

public Server(int port,
              MethodInterface handler)
       throws java.io.IOException
Create new method interface server.

Parameters:
port -
handler - method handler of local methods or
Throws:
java.io.IOException
Method Detail

close

public void close()
Stop listening for new connections and shutdown existing connections.


getPort

public int getPort()
Returns:
The port the server is listening.