Class TCPServer

java.lang.Object
java.lang.Thread
dev.forbit.server.abstracts.TCPServer
All Implemented Interfaces:
ConnectionServer, Runnable
Direct Known Subclasses:
GSONTCPServer, RawTCPServer

public abstract class TCPServer extends Thread implements ConnectionServer
  • Constructor Details

    • TCPServer

      public TCPServer()
  • Method Details

    • run

      public void run()
      Specified by:
      run in interface Runnable
      Overrides:
      run in class Thread
    • getConnectionPacket

      public abstract ConnectionPacket getConnectionPacket()
      Defines the Packet used for new connections
      Returns:
      ConnectionPacket
    • init

      public boolean init()
      Description copied from interface: ConnectionServer
      Initialise the server.
      Specified by:
      init in interface ConnectionServer
      Returns:
      false if an error occured
    • loop

      public void loop()
      Description copied from interface: ConnectionServer
      The basic loop that happens every tick
      Specified by:
      loop in interface ConnectionServer
    • select

      public int select()
      Gets the key ID
      Returns:
      the number of keys, or -1 for an exception