rcssjava.comm
Class Connection

java.lang.Object
  extended by rcssjava.comm.Connection

public class Connection
extends java.lang.Object

Handles UDP communication with the Soccer Server


Field Summary
static int MAX_MSG
          Maximum message size in bytes
 
Constructor Summary
Connection()
          Creates a socket, but doesn't connect to anything
Connection(java.lang.String hostName, int hostPort)
          Creates a socket and connects to host
 
Method Summary
 boolean connect(java.lang.String hostName, int hostPort)
          Connect to remote host
 void disconnect()
          Disconnect from server
 boolean isConnected()
          Is the socket connected?
 java.lang.String receive()
          Receive data from the server
 boolean send(java.lang.String msg)
          Send data to server
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_MSG

public static final int MAX_MSG
Maximum message size in bytes

See Also:
Constant Field Values
Constructor Detail

Connection

public Connection()
Creates a socket, but doesn't connect to anything


Connection

public Connection(java.lang.String hostName,
                  int hostPort)
Creates a socket and connects to host

Parameters:
hostName - name or IP address of host
hostPort - port number on host
Method Detail

connect

public boolean connect(java.lang.String hostName,
                       int hostPort)
Connect to remote host

Parameters:
hostName - name or IP address of host
hostPort - port number on host
Returns:
true if successful

disconnect

public void disconnect()
Disconnect from server


isConnected

public boolean isConnected()
Is the socket connected?


receive

public java.lang.String receive()
Receive data from the server

Returns:
data received as String

send

public boolean send(java.lang.String msg)
Send data to server

Parameters:
msg - String to send
Returns:
true if successful