3rd Eye Scene C#
3rd Eye Scene C# documentation
|
A client connection over TCP/IP. More...
Classes | |
class | ResourceInfo |
Resource tracking class. | |
Public Member Functions | |
TcpConnection (TcpClient socket, ServerFlag serverFlags) | |
Instantiates a
TcpClient | |
void | Close () |
Closes the connection. | |
int | UpdateFrame (float dt, bool flush=true) |
Frame update implementation. | |
int | Create (Shape shape) |
Sends a CreateMessage for the given shape | |
int | Destroy (Shape shape) |
Sends a DestroyMessage for the given shape | |
int | Update (Shape shape) |
Sends an UpdateMessage for the given shape | |
bool | SendServerInfo (ServerInfoMessage info) |
Sends the given ServerInfoMessage to the client. | |
int | Send (byte[] data, int offset, int length) |
Sends a previously encoded message to the client. | |
int | UpdateTransfers (int byteLimit) |
Update active transfers, transferring up to the given byteLimit . | |
uint | GetReferenceCount (Resource resource) |
Checks the reference count of a resource. | |
void | AddResources (Shape shape) |
Add all resources from shape , incrementing reference counts and sending resource data as required. | |
void | RemoveResources (Shape shape) |
Remove references for all resources of shape , decrementing resource counts as required. | |
uint | AddResource (Resource resource) |
Add a reference for resource . | |
uint | RemoveResource (Resource resource) |
Remove a reference for resource . | |
Protected Member Functions | |
int | SendInternal (byte[] data, int offset, int length, bool flushCollated) |
Sends a previously encoded message to the client. | |
Properties | |
IPEndPoint | EndPoint [get, set] |
The end point of the connection. | |
string | Address [get] |
The client address as extracted from the EndPoint | |
int | Port [get] |
The port on which the client is connected. | |
bool | Connected [get] |
True if the client is still connected. | |
ServerFlag | ServerFlags [get, set] |
The flags with which the client was connected. |
A client connection over TCP/IP.
Tes::Server::TcpConnection::TcpConnection | ( | TcpClient | socket, |
ServerFlag | serverFlags | ||
) | [inline] |
Instantiates a
TcpClient
using the given socket and flags.
socket | Socket. |
serverFlags | Server flags. |
uint Tes::Server::TcpConnection::AddResource | ( | Resource | resource | ) | [inline] |
Add a reference for resource .
resource | The resource of interest. |
The resource is enqueued for sending on the first reference.
Implements Tes::Net::IConnection.
void Tes::Server::TcpConnection::AddResources | ( | Shape | shape | ) | [inline] |
Add all resources from shape , incrementing reference counts and sending resource data as required.
shape | The shape of interest. |
The resource for shape are attained via Shape.Resources.
int Tes::Server::TcpConnection::Create | ( | Shape | shape | ) | [inline] |
Sends a CreateMessage for the given shape
shape | The shape for which to send a create message. |
Implements Tes::Net::IConnection.
int Tes::Server::TcpConnection::Destroy | ( | Shape | shape | ) | [inline] |
Sends a DestroyMessage for the given shape
shape | The shape for which to send a create message. |
Implements Tes::Net::IConnection.
uint Tes::Server::TcpConnection::GetReferenceCount | ( | Resource | resource | ) | [inline] |
Checks the reference count of a resource.
resource | The resource of interest. |
Implements Tes::Net::IConnection.
uint Tes::Server::TcpConnection::RemoveResource | ( | Resource | resource | ) | [inline] |
Remove a reference for resource .
resource | The resource of interest. |
A destroy message is sent for resource when the last resource is removed.
Implements Tes::Net::IConnection.
void Tes::Server::TcpConnection::RemoveResources | ( | Shape | shape | ) | [inline] |
Remove references for all resources of shape , decrementing resource counts as required.
shape | The shape of interest. |
int Tes::Server::TcpConnection::Send | ( | byte[] | data, |
int | offset, | ||
int | length | ||
) | [inline] |
Sends a previously encoded message to the client.
data | The data bytes to send. |
offset | Offset into data to start sending from. |
length | Number of bytes to send (from offset ). |
The given data are send as is, except that they may be collated and optionally compressed before sending, depending on the ServerFlag options set.
Implements Tes::Net::IConnection.
int Tes::Server::TcpConnection::SendInternal | ( | byte[] | data, |
int | offset, | ||
int | length, | ||
bool | flushCollated | ||
) | [inline, protected] |
Sends a previously encoded message to the client.
data | The data bytes to send. |
offset | Offset into data to start sending from. |
length | Number of bytes to send (from offset ). |
flushCollated | Ensure collated data packet is flushed after send? |
The given data are send as is, except that they may be collated and optionally compressed before sending, depending on the ServerFlag options set.
bool Tes::Server::TcpConnection::SendServerInfo | ( | ServerInfoMessage | info | ) | [inline] |
Sends the given ServerInfoMessage to the client.
info | Details of the server to send to the client. |
Should always be send as the first message to the client.
Implements Tes::Net::IConnection.
int Tes::Server::TcpConnection::Update | ( | Shape | shape | ) | [inline] |
Sends an UpdateMessage for the given shape
shape | The shape for which to send a create message. |
Implements Tes::Net::IConnection.
int Tes::Server::TcpConnection::UpdateFrame | ( | float | dt, |
bool | flush = true |
||
) | [inline] |
Frame update implementation.
See base class.
dt | Elapsed time for the frame just passed (seconds). |
flush | Flush transient objects? |
Implements Tes::Net::IConnection.
int Tes::Server::TcpConnection::UpdateTransfers | ( | int | byteLimit | ) | [inline] |
Update active transfers, transferring up to the given byteLimit .
byteLimit | The maximum number of bytes allowed to be transferred in this update. Zero for no limit. |
string Tes::Server::TcpConnection::Address [get] |
bool Tes::Server::TcpConnection::Connected [get] |
IPEndPoint Tes::Server::TcpConnection::EndPoint [get, set] |
The end point of the connection.
The end point.
int Tes::Server::TcpConnection::Port [get] |
ServerFlag Tes::Server::TcpConnection::ServerFlags [get, set] |
The flags with which the client was connected.
The server flags.
Not all flags are used with the client, but collation and compression are most notably used.