GLLib: TCP Class Reference

GLLib

TCP Class Reference
[TCP (used by XPlayer)]

Inherits Thread.

List of all members.


Public Member Functions

void connect ()
 Establish the connection.
void disconnect ()
 Close the connection.
byte[] recvPacket ()
 Gets the first available packet from receiving queue, or null.
void run ()
 Main running function for the communication thread.
void sendEstablishConnectionPackageOnReceive (byte[] data)
 Sends the establish message on the receive connection.
void sendPacket (byte[] data)
 Puts the data as packet to the sending queue.
 TCP (String url)
 Constructor for the TCP class.

Public Attributes

boolean m_bError
 Tells wether an error occured during the TCP/IP transaction.
String m_bErrorString
 Error string, used only when debugging is enabled.
boolean m_connected
 true if the connection is established with the multiplayer server, false otherwise.

Protected Attributes

StreamConnection connection = null
Vector incomingQueue
InputStream istream = null
OutputStream ostream = null
byte[] outgoing_data_on_receive_connection
Vector outgoingQueue
StreamConnection receive_connection = null
InputStream receive_istream = null
OutputStream receive_ostream = null
String url

Constructor & Destructor Documentation

TCP ( String  url  ) 

Constructor for the TCP class.

Parameters:
url The multiplayer server url.


Member Function Documentation

void connect (  ) 

Establish the connection.

void disconnect (  ) 

Close the connection.

byte [] recvPacket (  ) 

Gets the first available packet from receiving queue, or null.

Returns:
byte[]

void run (  ) 

Main running function for the communication thread.

void sendEstablishConnectionPackageOnReceive ( byte[]  data  ) 

Sends the establish message on the receive connection.

In order to establish a connection, two packages must be sent one on the receive connection and the other on the send connection.

The server will match them an create a new connection.

Parameters:
data byte[]

void sendPacket ( byte[]  data  ) 

Puts the data as packet to the sending queue.

Parameters:
data byte[]


Member Data Documentation

StreamConnection connection = null [protected]

Vector incomingQueue [protected]

InputStream istream = null [protected]

boolean m_bError

Tells wether an error occured during the TCP/IP transaction.

It is set to true if the there was an error in the communication with the multiplayer server, false otherwise.

Error string, used only when debugging is enabled.

boolean m_connected

true if the connection is established with the multiplayer server, false otherwise.

OutputStream ostream = null [protected]

Vector outgoingQueue [protected]

StreamConnection receive_connection = null [protected]

InputStream receive_istream = null [protected]

OutputStream receive_ostream = null [protected]

String url [protected]


Generated on Tue Sep 23 23:05:33 2008 for GLLib by  doxygen 1.5.2