Package dev.forbit.server.interfaces
Interface ConnectionServer
- All Known Implementing Classes:
GSONTCPServer
,GSONUDPServer
,RawTCPServer
,RawUDPServer
,TCPServer
,UDPServer
public interface ConnectionServer
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
begin()
Initialises the server and begins the loopGets the address to host the bind the server too.int
getPort()
Get the portGets the parentServer
object that the packet was received ondefault String
Returns a GSON serialised string of the objectboolean
init()
Initialise the server.boolean
Returns whether the server is currently runningvoid
loop()
The basic loop that happens every tickvoid
setRunning(boolean running)
Sets the server running statusdefault void
shutdown()
Sets running to falsevoid
start()
Start the server
-
Method Details
-
start
void start()Start the server -
getPort
int getPort()Get the port- Returns:
- port to host server on
-
getServer
Server getServer()Gets the parentServer
object that the packet was received on- Returns:
- Server that packet was received on
-
getAddress
String getAddress()Gets the address to host the bind the server too.- Returns:
- Address to host on.
-
shutdown
default void shutdown()Sets running to false -
isRunning
boolean isRunning()Returns whether the server is currently running- Returns:
- true if running
-
setRunning
void setRunning(boolean running)Sets the server running status- Parameters:
running
- running status
-
init
boolean init()Initialise the server.- Returns:
- false if an error occured
-
loop
void loop()The basic loop that happens every tick -
begin
Initialises the server and begins the loop- Throws:
ServerInitialisationError
- throws if there was an error in the initialisation phase.
-
getString
Returns a GSON serialised string of the object- Returns:
- GSON string
-