3rd Eye Scene C#
3rd Eye Scene C# documentation
Tes::Net::IConnection Interface Reference

Defines the interface for a TES connection. More...

Inheritance diagram for Tes::Net::IConnection:
Tes::IO::CollatedPacketEncoder Tes::Server::TcpConnection Tes::Util::CollatedPacketEncoder

List of all members.

Public Member Functions

void Close ()
 Closes the connection.
int UpdateFrame (float dt, bool flush=true)
 Sends a message marking the end of the current frame (and start of a new frame).
int Create (Shape shape)
 Sends a create message for shape .
int Destroy (Shape shape)
 Sends a destroy message for shape .
int Update (Shape shape)
 Sends an update message for shape .
bool SendServerInfo (ServerInfoMessage info)
 Sends the ServerInfoMessage structure to the connected client.
int Send (byte[] data, int offset, int length)
 Sends data on the client connection.
uint GetReferenceCount (Resource resource)
 Queries the reference count of the given resource.
uint AddResource (Resource resource)
 Add a shared resource to the connection.
uint RemoveResource (Resource resource)
 Removes a shared resource.

Properties

string Address [get]
 The connection end point address.
int Port [get]
 The connection port.
bool Connected [get]
 Reflects the connected state.

Detailed Description

Defines the interface for a TES connection.


Member Function Documentation

uint Tes::Net::IConnection::AddResource ( Resource  resource)

Add a shared resource to the connection.

Parameters:
resourceThe resource object to add. Increments the reference count if already present.
Returns:
The reference count for the resource after adding it.

Shape objects may have shared resources which must persist so long as any shape is referring to them. A prime example is MeshSet instances, each of which has at least one MeshResource. These parts may be referenced and shared by multiple MeshSet objects and are considered shared resources. Each part must persist so long as at least one shape is referencing it.

The concept is generalised to the Resource interface. Each call to AddResource(Resource) increases the reference counting of that resource and enables creation messages for that resource. Each call to RemoveResource(Resource) reduces the reference count. A destruction message is sent when a resource reaches a zero reference count.

Adding a shared resource adds it to the resource transfer queue. Data transfer may be amortised over the next series of updates and combined with the transfer of other shared resources.

Note: in order to differentiate shared resources, it is critical that each resource has an unique ID. This ID is used to identify the resource, not the object reference.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

int Tes::Net::IConnection::Create ( Shape  shape)

Sends a create message for shape .

Parameters:
shapeThe shape to create.
Returns:
The number of bytes queued for transfer for this message, or negative on error. The negative value may be less than -1 and still indicate the successful transfer size.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

int Tes::Net::IConnection::Destroy ( Shape  shape)

Sends a destroy message for shape .

Parameters:
shapeThe shape to destroy.
Returns:
The number of bytes queued for transfer for this message, or negative on error. The negative value may be less than -1 and still indicate the successful transfer size.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

uint Tes::Net::IConnection::GetReferenceCount ( Resource  resource)

Queries the reference count of the given resource.

Parameters:
resource
Returns:

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

uint Tes::Net::IConnection::RemoveResource ( Resource  resource)

Removes a shared resource.

Parameters:
resource
Returns:

The resource has its reference count decremented and is removed from the transfer queue. The destruction message is send to complete the removal, though there may be a delay before sending this message.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

int Tes::Net::IConnection::Send ( byte[]  data,
int  offset,
int  length 
)

Sends data on the client connection.

Parameters:
dataThe data buffer to send.
offsetAn offset into data at which to start sending.
lengthThe number of bytes to transfer.
Returns:
The number of bytes transferred or -1 on failure.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

bool Tes::Net::IConnection::SendServerInfo ( ServerInfoMessage  info)

Sends the ServerInfoMessage structure to the connected client.

Parameters:
infoThe info message to send.
Returns:
True on success.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

int Tes::Net::IConnection::Update ( Shape  shape)

Sends an update message for shape .

Parameters:
shapeThe shape to update.
Returns:
The number of bytes queued for transfer for this message, or negative on error. The negative value may be less than -1 and still indicate the successful transfer size.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.

int Tes::Net::IConnection::UpdateFrame ( float  dt,
bool  flush = true 
)

Sends a message marking the end of the current frame (and start of a new frame).

Parameters:
dtIndicates the time passed since over this frame (seconds).
flushTrue to allow clients to flush transient options, false to clients preserver such objects.
Returns:
The number of bytes queued for transfer for this message, or negative on error. The negative value may be less than -1 and still indicate the successful transfer size.

Implemented in Tes::IO::CollatedPacketEncoder, Tes::Server::TcpConnection, and Tes::Util::CollatedPacketEncoder.


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