Class OtpServer

All Implemented Interfaces:
OtpTransportFactory

@Deprecated public class OtpServer extends OtpSelf
Deprecated.
the functionality of this class has been moved to OtpSelf .
Represents a local OTP client or server node. It is used when you want other nodes to be able to establish connections to this one. When you create an instance of this class, it will bind a socket to a port so that incoming connections can be accepted. However the port number will not be made available to other nodes wishing to connect until you explicitely register with the port mapper daemon by calling OtpSelf.publishPort().

When the Java node will be connecting to a remote Erlang, Java or C node, it must first identify itself as a node by creating an instance of this class, after which it may connect to the remote node.

Setting up a connection may be done as follows:

 OtpServer self = new OtpServer("server", "cookie"); // identify self
 self.publishPort(); // make port information available

 OtpConnection conn = self.accept(); // get incoming connection
 
See Also:
  • Constructor Details

    • OtpServer

      public OtpServer(OtpSelf self) throws IOException
      Deprecated.
      Create an OtpServer from an existing OtpSelf.
      Parameters:
      self - an existing self node.
      Throws:
      IOException - if a ServerSocket could not be created.
    • OtpServer

      public OtpServer(String node, String cookie) throws IOException
      Deprecated.
      Create an OtpServer, using a vacant port chosen by the operating system. To determine what port was chosen, call the object's OtpLocalNode.port() method.
      Parameters:
      node - the name of the node.
      cookie - the authorization cookie that will be used by this node when accepts connections from remote nodes.
      Throws:
      IOException - if a ServerSocket could not be created.
    • OtpServer

      public OtpServer(String node, String cookie, int port) throws IOException
      Deprecated.
      Create an OtpServer, using the specified port number.
      Parameters:
      node - a name for this node, as above.
      cookie - the authorization cookie that will be used by this node when accepts connections from remote nodes.
      port - the port number to bind the socket to.
      Throws:
      IOException - if a ServerSocket could not be created or if the chosen port number was not available.