3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::Server::TcpConnection Class Reference

A client connection over TCP/IP. More...

Inheritance diagram for Tes::Server::TcpConnection:
Tes::Net::IConnection

List of all members.

Classes

class  ResourceInfo
 Resource tracking class.

Public Member Functions

 TcpConnection (TcpClient socket, ServerFlag serverFlags)
 Instantiates a

TcpClient

using the given socket and flags.

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.

Detailed Description

A client connection over TCP/IP.


Constructor & Destructor Documentation

Tes::Server::TcpConnection::TcpConnection ( TcpClient  socket,
ServerFlag  serverFlags 
) [inline]

Instantiates a

TcpClient

using the given socket and flags.

Parameters:
socketSocket.
serverFlagsServer flags.

Member Function Documentation

uint Tes::Server::TcpConnection::AddResource ( Resource  resource) [inline]

Add a reference for resource .

Parameters:
resourceThe resource of interest.
Returns:
The reference count after adding.

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.

Parameters:
shapeThe 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

Parameters:
shapeThe 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

Parameters:
shapeThe 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.

Parameters:
resourceThe resource of interest.
Returns:
The resource reference count. Zero implies an unknown resource.

Implements Tes::Net::IConnection.

uint Tes::Server::TcpConnection::RemoveResource ( Resource  resource) [inline]

Remove a reference for resource .

Parameters:
resourceThe resource of interest.
Returns:
The reference count after removal.

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.

Parameters:
shapeThe shape of interest.
int Tes::Server::TcpConnection::Send ( byte[]  data,
int  offset,
int  length 
) [inline]

Sends a previously encoded message to the client.

Parameters:
dataThe data bytes to send.
offsetOffset into data to start sending from.
lengthNumber of bytes to send (from offset ).
Returns:
The number of bytes send on success (length ) or -1 on failure.

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.

Parameters:
dataThe data bytes to send.
offsetOffset into data to start sending from.
lengthNumber of bytes to send (from offset ).
flushCollatedEnsure collated data packet is flushed after send?
Returns:
The number of bytes send on success (length ) or -1 on failure.

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.

Parameters:
infoDetails 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

Parameters:
shapeThe 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.

Parameters:
dtElapsed time for the frame just passed (seconds).
flushFlush transient objects?
Returns:
The number of bytes sent to trigger the frame update.

Implements Tes::Net::IConnection.

int Tes::Server::TcpConnection::UpdateTransfers ( int  byteLimit) [inline]

Update active transfers, transferring up to the given byteLimit .

Parameters:
byteLimitThe maximum number of bytes allowed to be transferred in this update. Zero for no limit.

Property Documentation

string Tes::Server::TcpConnection::Address [get]

The client address as extracted from the EndPoint

The address.

Implements Tes::Net::IConnection.

bool Tes::Server::TcpConnection::Connected [get]

True if the client is still connected.

The connected.

Implements Tes::Net::IConnection.

IPEndPoint Tes::Server::TcpConnection::EndPoint [get, set]

The end point of the connection.

The end point.

int Tes::Server::TcpConnection::Port [get]

The port on which the client is connected.

The port.

Implements Tes::Net::IConnection.

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.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions Variables Enumerations Properties Events