Class TCPClient

java.lang.Object
com.github.perdia.tcp.TCPClient

public class TCPClient extends Object
Class for connecting to as well as writing and receiving data from the server socket Perdia-DB is running on
  • Constructor Details

    • TCPClient

      public TCPClient(String host, int port)
      Constructor for the TCPClient class
      Parameters:
      host - The hostname or IP-address of the server
      port - The port on the server the client is supposed to connect to
  • Method Details

    • write

      public void write(byte[] text)
      Sends the given data to the Perdia-DB server. If the given server socket does not exist, is offline or refusing connection, an IOException is thrown and caught.
      Parameters:
      text - Byte array containing the single characters of the query text encoded in UTF-8
    • read

      public byte[] read()
      Receives data sent by the Perdia-DB server. If the given server socket does not exist, is offline or refusing connection, an IOException is thrown and caught.
      Returns:
      Byte array containing the single characters of the query text encoded in UTF-8