C# Класс Cakewalk.NetEntity

Networking core of the server
Наследование: IDisposable
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
BIN int
BOUT int
IN int
OUT int

Защищенные свойства (Protected)

Свойство Тип Описание
m_receiveArgs System.Net.Sockets.SocketAsyncEventArgs
m_sendArgs System.Net.Sockets.SocketAsyncEventArgs

Открытые методы

Метод Описание
Authorise ( ) : void

Send an authorisation request.

DeferredSendPacket ( IPacketBase packet ) : void

Queues a packet to be send on the next update. Will coalesce these packets together.

Dispose ( ) : void

Clean up this entity

NetEntity ( Socket socket, int worldID, SocketAsyncEventArgs sendEventArgs, SocketAsyncEventArgs receiveEventArgs ) : System

Create a new entity from a socket and immediately assign it a world id. Requires async socket context objects with buffers pre-assigned

SendClockSync ( ) : void

Send a clock sync request, if there is not already one pending.

SendPacket ( IPacketBase packet ) : void

Enqueue a packet for sending over the wire

Update ( System.TimeSpan dt ) : void

Updates this entity, flushes and handles any pending packets in the incoming queue.

Защищенные методы

Метод Описание
HandlePacket ( IPacketBase packet ) : void

Packet handler logic

Приватные методы

Метод Описание
DeserializePacket ( IntPtr buffer ) : int

Deserializes a packet from the given buffer. Returns the amount of bytes consumed.

QueueReceive ( ) : void

Begins data receive task on the thread pool

QueueSend ( ) : void

Begins data send task on the thread pool

Receive ( ) : void

Starts an async receive from the socket

ReceiveCompleted ( object sender, SocketAsyncEventArgs e ) : void

Handle a received packet

Send ( ) : void

Poll the outgoing queue and send any packets

SendCompleted ( object sender, SocketAsyncEventArgs e ) : void

Event handler for async send completion

SerializePacket ( IPacketBase packet ) : void

Serialize the given packet into the send buffer.

SyncClock ( int remoteTime ) : void

Synchronises the network clock using any round trip time data available.

Описание методов

Authorise() публичный Метод

Send an authorisation request.
public Authorise ( ) : void
Результат void

DeferredSendPacket() публичный Метод

Queues a packet to be send on the next update. Will coalesce these packets together.
public DeferredSendPacket ( IPacketBase packet ) : void
packet IPacketBase
Результат void

Dispose() публичный Метод

Clean up this entity
public Dispose ( ) : void
Результат void

HandlePacket() защищенный Метод

Packet handler logic
protected HandlePacket ( IPacketBase packet ) : void
packet IPacketBase
Результат void

NetEntity() публичный Метод

Create a new entity from a socket and immediately assign it a world id. Requires async socket context objects with buffers pre-assigned
public NetEntity ( Socket socket, int worldID, SocketAsyncEventArgs sendEventArgs, SocketAsyncEventArgs receiveEventArgs ) : System
socket System.Net.Sockets.Socket
worldID int
sendEventArgs System.Net.Sockets.SocketAsyncEventArgs
receiveEventArgs System.Net.Sockets.SocketAsyncEventArgs
Результат System

SendClockSync() публичный Метод

Send a clock sync request, if there is not already one pending.
public SendClockSync ( ) : void
Результат void

SendPacket() публичный Метод

Enqueue a packet for sending over the wire
public SendPacket ( IPacketBase packet ) : void
packet IPacketBase
Результат void

Update() публичный Метод

Updates this entity, flushes and handles any pending packets in the incoming queue.
public Update ( System.TimeSpan dt ) : void
dt System.TimeSpan
Результат void

Описание свойств

BIN публичное статическое свойство

public static int BIN
Результат int

BOUT публичное статическое свойство

public static int BOUT
Результат int

IN публичное статическое свойство

public static int IN
Результат int

OUT публичное статическое свойство

public static int OUT
Результат int

m_receiveArgs защищенное свойство

Async receive context object
protected SocketAsyncEventArgs,System.Net.Sockets m_receiveArgs
Результат System.Net.Sockets.SocketAsyncEventArgs

m_sendArgs защищенное свойство

Async send context object
protected SocketAsyncEventArgs,System.Net.Sockets m_sendArgs
Результат System.Net.Sockets.SocketAsyncEventArgs