Klasse NetSIDDevConnection

java.lang.Object
builder.netsiddev.NetSIDDevConnection

public class NetSIDDevConnection extends Object
  • Felddetails

    • SOCKET_CONNECT_TIMEOUT

      private static final int SOCKET_CONNECT_TIMEOUT
      Timeout to establish a connection to a NetworkSIDDevice im ms.
      Siehe auch:
    • MAX_STRING_LENGTH

      private static final int MAX_STRING_LENGTH
      Maximum string length read from server.
      Siehe auch:
    • ISO_8859_1

      private static final Charset ISO_8859_1
      Expected string encoding read from server.
    • invalidated

      private boolean invalidated
    • connectedSocket

      private Socket connectedSocket
    • stringBytes

      private byte[] stringBytes
    • connection

      private static NetSIDDevConnection connection
      Single instance connection.
  • Konstruktordetails

    • NetSIDDevConnection

      private NetSIDDevConnection()
  • Methodendetails

    • getInstance

      public static final NetSIDDevConnection getInstance()
    • open

      public void open(String hostname, int port) throws IOException
      Connect to server, if not already connected or connection changed
      Parameter:
      hostname - server host name
      port - server port address
      Löst aus:
      IOException - socket I/O error
    • connect

      private void connect(String hostname, int port) throws IOException
      Open connection to server
      Parameter:
      hostname - server host name
      port - server port address
      Löst aus:
      IOException - socket I/O error
    • close

      public void close()
      Close the connection.
    • isClosed

      private boolean isClosed()
      Connection has been closed?
      Gibt zurück:
      connection closed
    • invalidate

      public void invalidate()
      Invalidate the connection.
    • isInvalidated

      public boolean isInvalidated()
      Connection has been invalidated?
      Gibt zurück:
      connection invalid, must be re-opened
    • send

      public void send(byte[] cmd) throws IOException
      Send byte array to server.
      Parameter:
      cmd - byte array to send
      Löst aus:
      IOException - socket I/O error
    • receive

      public int receive() throws IOException
      Receive byte from server.
      Gibt zurück:
      received byte
      Löst aus:
      IOException - socket I/O error
    • receiveString

      public String receiveString() throws IOException
      Receive zero terminated byte array as string (ISO-88-59-1).
      Gibt zurück:
      string received from server.
      Löst aus:
      IOException - socket I/O error
    • isDisconnected

      public boolean isDisconnected()