public class ServerConnection extends SocketConnection
MONITOR_PORT, REMOTE_SERVER_IP, SERVER_IP, SERVER_PORT
Constructor and Description |
---|
ServerConnection()
Default constructor
|
ServerConnection(java.lang.String host,
int port)
Assignment constructor
|
Modifier and Type | Method and Description |
---|---|
void |
closeConnection() |
void |
establishConnection()
Actually connect to the server
|
void |
sendMessage(byte[] msg)
Send a message to the server
|
void |
startReceiveLoop()
Starts the endless loop of receiving messages and notifying observers
|
attach, isConnected, stopReceiveLoop
public ServerConnection()
public ServerConnection(java.lang.String host, int port)
host
- Host addressport
- Port numberpublic void establishConnection() throws ConnectionException
ConnectionException
public void sendMessage(byte[] msg) throws ConnectionException
msg
- Message in ASCII formConnectionException
public void startReceiveLoop() throws ConnectionException
ConnectionException
- if any connection problem occuredpublic void closeConnection()