Photon Server API Documentation v5.0RC1

Public Member Functions | Protected Member Functions | Properties | List of all members
Photon.SocketServer.ServerToServer.TcpClientBase Class Referenceabstract

Base class for Tcp client implementations. More...

Inheritance diagram for Photon.SocketServer.ServerToServer.TcpClientBase:
Photon.SocketServer.ServerToServer.TcpClient

Public Member Functions

void Connect (IPEndPoint remoteEndPoint, string applicationId)
 Establishes a connection to the remote host. More...
 
void Connect (IPEndPoint remoteEndPoint, string applicationId, IPEndPoint localEndPoint)
 Establishes a connection to the remote host. More...
 
void Disconnect ()
 Closes the connection to the remote host. More...
 
SendResult InitializeEncryption ()
 Initializes the peer to receive and send encrypted operations. More...
 
SendResult SendOperationRequest (OperationRequest operationRequest, SendParameters sendParameters)
 Sends an operation request to the server. More...
 
SendResult SendPing ()
 Sends a ping request to the server. The ping request will be send with Environment.TickCount as the tme stamp. More...
 
SendResult SendPing (int timeStamp)
 Sends a ping request to the server. More...
 
void Dispose ()
 Releases all resources used this instance. More...
 
SendResult Send (byte[] data, SendParameters sendParameters)
 Sends bytes ... More...
 

Protected Member Functions

 TcpClientBase ()
 Initializes a new instance of the TcpClientBase class. More...
 
 TcpClientBase (IRpcProtocol protocol)
 Initializes a new instance of the TcpClientBase class. More...
 
 TcpClientBase (Version clientVersion)
 Initializes a new instance of the TcpClientBase class. More...
 
 TcpClientBase (IRpcProtocol protocol, Version clientVersion)
 Initializes a new instance of the TcpClientBase class. More...
 
virtual void Dispose (bool disposing)
 Releases unmanaged and - optionally - managed resources More...
 
virtual void OnReceived (byte[] data, SendParameters sendParameters)
 Invoked when data was received. More...
 
abstract void OnAsyncSocketError (SocketError socketError)
 A asynchronous operation completed with a SocketError. More...
 
abstract void OnConnectCompleted ()
 On connect completed... More...
 
abstract void OnConnectError (SocketError socketError)
 On connect error... More...
 
abstract void OnDisconnect (SocketError socketError)
 On disconnect ... More...
 
abstract void OnEvent (IEventData eventData, SendParameters sendParameters)
 The on event. More...
 
virtual void OnInitializeEcryptionCompleted (short resultCode, string debugMessage)
 Invoked if an initialize encryption request was completed. More...
 
abstract void OnOperationResponse (OperationResponse operationResponse, SendParameters sendParameters)
 The on operation response. More...
 
abstract void OnPingResponse (PingResponse pingResponse)
 The on ping response. More...
 

Properties

string ApplicationId [get]
 Gets the application id. More...
 
Version ClientVersion [get]
 Gets the client version. More...
 
bool Connected [get]
 Gets a value indicating whether this instance is connected to a remote host. More...
 
ICryptoProvider CryptoProvider [get, set]
 Gets or sets the CryptoProvider. More...
 
IPEndPoint LocalEndPoint [get]
 Gets the local endpoint. More...
 
IRpcProtocol Protocol [get]
 Gets the used rpc protocol. More...
 
IPEndPoint RemoteEndPoint [get]
 Gets the remote end point. More...
 
ConnectionState ConnectionState [get]
 
bool IsConnectionSecure [get]
 

Detailed Description

Base class for Tcp client implementations.

Constructor & Destructor Documentation

◆ TcpClientBase() [1/4]

Photon.SocketServer.ServerToServer.TcpClientBase.TcpClientBase ( )
inlineprotected

Initializes a new instance of the TcpClientBase class.

◆ TcpClientBase() [2/4]

Photon.SocketServer.ServerToServer.TcpClientBase.TcpClientBase ( IRpcProtocol  protocol)
inlineprotected

Initializes a new instance of the TcpClientBase class.

Parameters
protocolThe IRpcProtocol to use for operation and event serialization.

◆ TcpClientBase() [3/4]

Photon.SocketServer.ServerToServer.TcpClientBase.TcpClientBase ( Version  clientVersion)
inlineprotected

Initializes a new instance of the TcpClientBase class.

Parameters
clientVersionThe client version.

◆ TcpClientBase() [4/4]

Photon.SocketServer.ServerToServer.TcpClientBase.TcpClientBase ( IRpcProtocol  protocol,
Version  clientVersion 
)
inlineprotected

Initializes a new instance of the TcpClientBase class.

Parameters
protocolThe IRpcProtocol to use for operation and event serialization.
clientVersionThe client version.

Member Function Documentation

◆ Connect() [1/2]

void Photon.SocketServer.ServerToServer.TcpClientBase.Connect ( IPEndPoint  remoteEndPoint,
string  applicationId 
)
inline

Establishes a connection to the remote host.

Parameters
remoteEndPointThe remote end point to connect to.
applicationIdThe photon application to connect to.

◆ Connect() [2/2]

void Photon.SocketServer.ServerToServer.TcpClientBase.Connect ( IPEndPoint  remoteEndPoint,
string  applicationId,
IPEndPoint  localEndPoint 
)
inline

Establishes a connection to the remote host.

Parameters
remoteEndPointThe remote end point to connect to.
applicationIdThe photon application to connect to.
localEndPointThe local end point to bind the socket to. Use null to avoid binding.

◆ Disconnect()

void Photon.SocketServer.ServerToServer.TcpClientBase.Disconnect ( )
inline

Closes the connection to the remote host.

◆ Dispose() [1/2]

void Photon.SocketServer.ServerToServer.TcpClientBase.Dispose ( )
inline

Releases all resources used this instance.

◆ Dispose() [2/2]

virtual void Photon.SocketServer.ServerToServer.TcpClientBase.Dispose ( bool  disposing)
inlineprotectedvirtual

Releases unmanaged and - optionally - managed resources

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

◆ InitializeEncryption()

SendResult Photon.SocketServer.ServerToServer.TcpClientBase.InitializeEncryption ( )
inline

Initializes the peer to receive and send encrypted operations.

Returns
Returns SendResult.Ok if the event was successfully sent; otherwise an error value. See SendResult for more information.

◆ OnAsyncSocketError()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnAsyncSocketError ( SocketError  socketError)
protectedpure virtual

A asynchronous operation completed with a SocketError.

Parameters
socketErrorThe socket error.

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnConnectCompleted()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnConnectCompleted ( )
protectedpure virtual

On connect completed...

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnConnectError()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnConnectError ( SocketError  socketError)
protectedpure virtual

On connect error...

Parameters
socketErrorThe error.

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnDisconnect()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnDisconnect ( SocketError  socketError)
protectedpure virtual

On disconnect ...

Parameters
socketErrorThe error.

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnEvent()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnEvent ( IEventData  eventData,
SendParameters  sendParameters 
)
protectedpure virtual

The on event.

Parameters
eventDataThe event data.
sendParametersThe send parameters the event was received with.

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnInitializeEcryptionCompleted()

virtual void Photon.SocketServer.ServerToServer.TcpClientBase.OnInitializeEcryptionCompleted ( short  resultCode,
string  debugMessage 
)
inlineprotectedvirtual

Invoked if an initialize encryption request was completed.

Parameters
resultCodeThe result code.
debugMessageThe debuf message.

Reimplemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnOperationResponse()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnOperationResponse ( OperationResponse  operationResponse,
SendParameters  sendParameters 
)
protectedpure virtual

The on operation response.

Parameters
operationResponseThe operation response.
sendParametersThe send parameters the event was received with.

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnPingResponse()

abstract void Photon.SocketServer.ServerToServer.TcpClientBase.OnPingResponse ( PingResponse  pingResponse)
protectedpure virtual

The on ping response.

Parameters
pingResponseThe ping response.

Implemented in Photon.SocketServer.ServerToServer.TcpClient.

◆ OnReceived()

virtual void Photon.SocketServer.ServerToServer.TcpClientBase.OnReceived ( byte[]  data,
SendParameters  sendParameters 
)
inlineprotectedvirtual

Invoked when data was received.

Parameters
dataThe received data.
sendParametersThe send parameters the data was received with.

◆ Send()

SendResult Photon.SocketServer.ServerToServer.TcpClientBase.Send ( byte[]  data,
SendParameters  sendParameters 
)
inline

Sends bytes ...

Parameters
dataThe data.
sendParametersThe send parameters are received on the server and can be used for further dispatching.
Returns
Ok or disconnected

◆ SendOperationRequest()

SendResult Photon.SocketServer.ServerToServer.TcpClientBase.SendOperationRequest ( OperationRequest  operationRequest,
SendParameters  sendParameters 
)
inline

Sends an operation request to the server.

Parameters
operationRequestThe operation request.
sendParametersThe send parameters.
Returns
Returns SendResult.Ok if the operation request was successfully sent; otherwise an error value. See SendResult for more information.

◆ SendPing() [1/2]

SendResult Photon.SocketServer.ServerToServer.TcpClientBase.SendPing ( )
inline

Sends a ping request to the server. The ping request will be send with Environment.TickCount as the tme stamp.

Returns
Returns OK or disconnected.

◆ SendPing() [2/2]

SendResult Photon.SocketServer.ServerToServer.TcpClientBase.SendPing ( int  timeStamp)
inline

Sends a ping request to the server.

Parameters
timeStampA user definined time stamp. The time stamp will be send back by the server with the ping response ans can be used to mesure the duration of the request.
Returns
Returns OK or disconnected.

Property Documentation

◆ ApplicationId

string Photon.SocketServer.ServerToServer.TcpClientBase.ApplicationId
get

Gets the application id.

◆ ClientVersion

Version Photon.SocketServer.ServerToServer.TcpClientBase.ClientVersion
get

Gets the client version.

◆ Connected

bool Photon.SocketServer.ServerToServer.TcpClientBase.Connected
get

Gets a value indicating whether this instance is connected to a remote host.

◆ ConnectionState

ConnectionState Photon.SocketServer.ServerToServer.TcpClientBase.ConnectionState
get

◆ CryptoProvider

ICryptoProvider Photon.SocketServer.ServerToServer.TcpClientBase.CryptoProvider
getset

Gets or sets the CryptoProvider.

◆ IsConnectionSecure

bool Photon.SocketServer.ServerToServer.TcpClientBase.IsConnectionSecure
get

◆ LocalEndPoint

IPEndPoint Photon.SocketServer.ServerToServer.TcpClientBase.LocalEndPoint
get

Gets the local endpoint.

◆ Protocol

IRpcProtocol Photon.SocketServer.ServerToServer.TcpClientBase.Protocol
get

Gets the used rpc protocol.

◆ RemoteEndPoint

IPEndPoint Photon.SocketServer.ServerToServer.TcpClientBase.RemoteEndPoint
get

Gets the remote end point.