Photon Server API
Classes | Public Member Functions | Static Public Attributes | Properties | Events | List of all members
ExitGames.Net.Sockets.PooledSender Class Reference

This ISocketSender wrapper is used to send the data async using a the .NET thread pool. An optional settings allows the PooledSender to send multiple messages in a batch. More...

Inheritance diagram for ExitGames.Net.Sockets.PooledSender:
ExitGames.Net.Sockets.ISocketSender

Classes

class  SendErrorEventArgs
 The event args for event SendError. More...
 

Public Member Functions

 PooledSender (ISocketSender sender)
 Initializes a new instance of the PooledSender class. More...
 
 PooledSender (ISocketSender sender, bool sendBatched, int packageSize)
 Initializes a new instance of the PooledSender class. More...
 
void Dispose ()
 Disposes the PooledSender. More...
 
void Send (byte[] data)
 Sends a byte array to the socket. More...
 
void Send (byte[] data, int offset, int length)
 Sends a byte array to the socket. More...
 
void Send (IList< ArraySegment< byte >> data)
 Sends a list of ArraySegment<T> of type byte to the socket. More...
 

Static Public Attributes

static readonly int DefaultBatchSize = 1024 * 32
 The default batch size. More...
 

Properties

bool Connected [get]
 Gets a value indicating whether the ISocketSender is connected to a remote host as of the last Send operation. More...
 
IPEndPoint EndPoint [get]
 Gets the remote end point. More...
 
long TotalBytesSent [get]
 Gets the total number of bytes sent. More...
 
PoolFiber Fiber [get]
 Gets the internally used fiber. More...
 
- Properties inherited from ExitGames.Net.Sockets.ISocketSender
bool Connected [get]
 Gets a value indicating whether the ISocketSender is connected to a remote host as of the last Send operation. More...
 
IPEndPoint EndPoint [get]
 Gets the remote end point. More...
 
long TotalBytesSent [get]
 Gets the total number of sent bytes. More...
 

Events

EventHandler< SendErrorEventArgsSendError
 This event is invoked if an unexpected error occurs. More...
 

Detailed Description

This ISocketSender wrapper is used to send the data async using a the .NET thread pool. An optional settings allows the PooledSender to send multiple messages in a batch.

Constructor & Destructor Documentation

ExitGames.Net.Sockets.PooledSender.PooledSender ( ISocketSender  sender)
inline

Initializes a new instance of the PooledSender class.

Parameters
senderThe ISocketSender that is used to send the data.
ExitGames.Net.Sockets.PooledSender.PooledSender ( ISocketSender  sender,
bool  sendBatched,
int  packageSize 
)
inline

Initializes a new instance of the PooledSender class.

Parameters
senderThe ISocketSender that is used to send the data.
sendBatchedIndicates whether multiple data should be send batched.
packageSizeThe size for batch packages.

Member Function Documentation

void ExitGames.Net.Sockets.PooledSender.Dispose ( )
inline

Disposes the PooledSender.

void ExitGames.Net.Sockets.PooledSender.Send ( byte[]  data)
inline

Sends a byte array to the socket.

Parameters
dataThe data.

Implements ExitGames.Net.Sockets.ISocketSender.

void ExitGames.Net.Sockets.PooledSender.Send ( byte[]  data,
int  offset,
int  length 
)
inline

Sends a byte array to the socket.

Parameters
dataThe data.
offsetThe offset.
lengthThe length.

Implements ExitGames.Net.Sockets.ISocketSender.

void ExitGames.Net.Sockets.PooledSender.Send ( IList< ArraySegment< byte >>  data)
inline

Sends a list of ArraySegment<T> of type byte to the socket.

Parameters
dataThe data.

Implements ExitGames.Net.Sockets.ISocketSender.

Member Data Documentation

readonly int ExitGames.Net.Sockets.PooledSender.DefaultBatchSize = 1024 * 32
static

The default batch size.

32 KB

Property Documentation

bool ExitGames.Net.Sockets.PooledSender.Connected
get

Gets a value indicating whether the ISocketSender is connected to a remote host as of the last Send operation.

IPEndPoint ExitGames.Net.Sockets.PooledSender.EndPoint
get

Gets the remote end point.

Returns the underlying ISocketSender.EndPoint.

PoolFiber ExitGames.Net.Sockets.PooledSender.Fiber
get

Gets the internally used fiber.

long ExitGames.Net.Sockets.PooledSender.TotalBytesSent
get

Gets the total number of bytes sent.

Returns the underlying ISocketSender.TotalBytesSent.

Event Documentation

EventHandler<SendErrorEventArgs> ExitGames.Net.Sockets.PooledSender.SendError

This event is invoked if an unexpected error occurs.