Photon Server API Documentation v5.0RC1

Classes | Public Member Functions | Protected Member Functions | List of all members
Photon.SocketServer.ServerToServer.OutboundS2SPeer Class Referenceabstract

Server2Server peer for establishing server 2 server connection More...

Inheritance diagram for Photon.SocketServer.ServerToServer.OutboundS2SPeer:
Photon.SocketServer.ServerToServer.S2SPeerBase Photon.SocketServer.PeerBase Photon.LoadBalancing.GameServer.OutgoingMasterServerPeer

Public Member Functions

bool ConnectTcp (IPEndPoint remoteEndPoint, string applicationName, bool useMux=false, IRpcProtocol protocol=null)
 
bool ConnectTcp (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, bool useMux=false, IRpcProtocol protocol=null)
 
bool ConnectTcp (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, byte[] token, IRpcProtocol protocol=null)
 
bool ConnectToServerUdp (IPEndPoint remoteEndPoint, string applicationName, byte numChannels, short? mtu)
 
bool ConnectToServerUdp (IPEndPoint remoteEndPoint, string applicationName, byte numChannels, short? mtu, IRpcProtocol protocol, bool useInitV3)
 
bool ConnectToServerUdp (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, byte numChannels, short? mtu)
 
bool ConnectToServerUdp (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, byte[] token, byte numChannels, short? mtu, IRpcProtocol protocol=null)
 
bool ConnectToServerWebSocket (IPEndPoint remoteEndPoint, string applicationName, WebSocketVersion webSocketVersion, IRpcProtocol protocol)
 
bool ConnectToServerWebSocket (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, WebSocketVersion webSocketVersion, IRpcProtocol protocol)
 
bool ConnectToServerWebSocketHixie76 (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, string origin, byte[] token=null)
 
bool ConnectToServerWebSocketHixie76 (IPEndPoint remoteEndPoint, string applicationName, string origin)
 
bool ConnectToServerWebRTC (IPEndPoint remoteEndPoint, string applicationName, object customInitObject, IRpcProtocol protocol, byte[] token=null)
 
void InitUdpEncryption (byte[] encryptSecret, byte[] authSecret, uint[] initSeqNums)
 
void SetClientVersion (Version version)
 
- Public Member Functions inherited from Photon.SocketServer.ServerToServer.S2SPeerBase
SendResult InitializeEncryption ()
 Initializes the peer to receive and send encrypted operations. More...
 
SendResult SendOperationRequest (OperationRequest operationRequest, SendParameters sendParameters)
 Sends an operation request. More...
 
SendResult SendOperationRequestAndDisconnect (OperationRequest operationRequest, SendParameters sendParameters, int disconnectDelay=DefaultDisconnectInterval, int disconnectError=ErrorCodes.Ok)
 
- Public Member Functions inherited from Photon.SocketServer.PeerBase
void Initialize (InitRequest initRequest)
 
override string ToString ()
 
void Disconnect (int disconnectError=ErrorCodes.Ok)
 Closes the connection. More...
 
void AbortConnection ()
 Forces the connection to close immediately. Should only be used if "Disconnect" does not lead to a clean connection shutdown, e.g. in case of an overloaded connection. More...
 
void Flush ()
 Flushes all pending data to the socket. More...
 
byte[] InitializeEncryption (byte[] otherPartyPublicKey)
 Initializes the peer to receive and send encrypted operations with EncryptionMethod.Sha256Pkcs7. More...
 
byte[] InitializeEncryption (byte[] otherPartyPublicKey, EncryptionMethod mode)
 Initializes the peer to receive and send encrypted operations. More...
 
bool SetupEncryption (EncryptionData encryptionData, byte channelCount, out short errorCode, out string errorMsg)
 
SendResult SendEvent (IEventData eventData, SendParameters sendParameters)
 Sends an IEventData object to the client. More...
 
SendResult SendMessage (object message, SendParameters sendParameters)
 
SendResult SendOperationResponse (OperationResponse operationResponse, SendParameters sendParameters)
 Sends the operation response to the client. More...
 
SendResult SendDisconnectMessage (DisconnectMessage message, SendParameters sendParameters, int disconnectDelay=DefaultDisconnectInterval)
 
void GetStats (out int roundTripTime, out int roundTripTimeVariance, out int numFailures)
 
void SetDebugString (string message)
 
string GetDebugString ()
 
virtual string GetHistograms ()
 
SendResult SendEventAndDisconnect (IEventData eventData, SendParameters sendParameters, int disconnectDelay=DefaultDisconnectInterval, int disconnectCode=ErrorCodes.Ok)
 
SendResult SendMessageAndDisconnect (object message, SendParameters sendParameters, int disconnectDelay=DefaultDisconnectInterval, int disconnectCode=ErrorCodes.Ok)
 
SendResult SendOperationResponseAndDisconnect (OperationResponse operationResponse, SendParameters sendParameters, int disconnectDelay=DefaultDisconnectInterval)
 Sends the operation response to the client. More...
 
void ScheduleDisconnect (int disconnectError, int delay)
 Schedules disconnect for peer. After this call data will be neither accepted from nor sent to client one of use cases is next: send error info and schedule for disconnect. this will give a chance to error information to reach a client More...
 
int GetLastTouch ()
 
void SetPrivateCustomTypeCache (CustomTypeCache cache)
 Sets private custom type cache. It is supposed to be used together with plugins. In other case Protocol.TryRegisterCustomType should be used More...
 
void SetInboundController (InboundController controller)
 
void Dispose ()
 Disposes the peer. More...
 
void Trace (bool enabled, object tag)
 

Protected Member Functions

 OutboundS2SPeer (ApplicationBase application)
 
 OutboundS2SPeer (ApplicationBase application, IRpcProtocol protocol)
 
abstract void OnConnectionEstablished (object responseObject)
 
virtual void OnConnectionEstablished (InitV3Response initResponse)
 
abstract void OnConnectionFailed (int errorCode, string errorMessage)
 
override void Dispose (bool disposing)
 Disposes the internal fibers. More...
 
- Protected Member Functions inherited from Photon.SocketServer.ServerToServer.S2SPeerBase
 S2SPeerBase (InitResponse response)
 Initializes a new instance of the S2SPeerBase class. More...
 
override void OnReceive (byte[] data, SendParameters sendParameters)
 Invoked if incoming data was received for the peer. More...
 
virtual void OnDisconnectMessage (DisconnectMessage message)
 
virtual void OnInitializeEcryptionCompleted (short resultCode, string debugMessage)
 Invoked if an initialize encryption request was completed. More...
 
override void Dispose (bool disposing)
 Disposes the internal fibers. More...
 
- Protected Member Functions inherited from Photon.SocketServer.PeerBase
virtual SendResult SendData (byte[] data, SendParameters sendParameters)
 Sends bytes to the client. More...
 
void OnMessageInternal (object message, SendParameters sendParameters)
 
void OnOperationRequestInternal (OperationRequest operationRequest, SendParameters sendParameters)
 
abstract void OnDisconnect (int reasonCode, string reasonDetail)
 The connection was closed. More...
 
virtual void OnSendBufferEmpty ()
 The default behavior of OnSendBufferFull is to disconnect the client. If this behavior is changed (override) the inheritor can pause sending until OnSendBufferEmpty is called. More...
 
virtual void OnDeserializationError (byte[] data, RtsMessageType msgType, string debugMessage, short errorCode=ErrorCodes.UnexpectedData, byte opCode=0, Exception exception=null)
 This method is called if incoming data has an unexpected format. Per default this method disconnects the client. Override to change this behavior. More...
 
OperationRequest ParseOperationRequest (byte[] data, SendParameters sendParameters)
 
OperationRequest ParseInternalOperationRequest (byte[] data, SendParameters sendParameters)
 
object ParseMessage (byte[] data, SendParameters sendParameters)
 
byte[] ParseRawMessage (byte[] data, SendParameters sendParameters)
 
void HandleParseError (byte[] data, SendParameters sendParameters, Exception exception, string errorMsg, short errorCode, RtsMessageType msgType, byte operationCode=0)
 
void GetTraceStatus (out int traceOptions, out int enableOptions, out string tag)
 
void DisconnectAfterSend (int disconnectCode, int disconnectDelay, SendResult result)
 
virtual void OnEncryptionQueueOverload (EncryptionQueueFailureParams failureParams)
 

Additional Inherited Members

- Public Attributes inherited from Photon.SocketServer.PeerBase
bool Connected => this.ConnectionState == ConnectionState.Connected || this.connectionState == ConnectionState.ScheduledForDisconnect
 Gets a value indicating whether this PeerBase instance is connected. More...
 
int ConnectionId => this.UnmanagedPeer.GetConnectionID()
 Gets the connection id. More...
 
bool IsConnectionSecure => this.datagramEncryptionUsed || this.NetworkProtocol == NetworkProtocolType.SecureWebSocket
 
bool Disposed => this.ConnectionState == ConnectionState.Disposed
 Gets a value indicating whether the peer was disposed. More...
 
bool ScheduledForDisconnect => this.connectionState == ConnectionState.ScheduledForDisconnect
 
IPAddress LocalIPAddress => string.IsNullOrEmpty(this.LocalIP) ? IPAddress.None : IPAddress.Parse(this.LocalIP)
 Gets the IP Address the client connects to. More...
 
IPAddress RemoteIPAddress => string.IsNullOrEmpty(this.RemoteIP) ? IPAddress.None : IPAddress.Parse(this.RemoteIP)
 Gets the client's remote IP address. More...
 
IFiber RequestFiber => this.requestFiber
 Gets fiber for incoming messages. More...
 
bool LocalIPAddressIsIPv6 => this.LocalIPAddress.AddressFamily == AddressFamily.InterNetworkV6
 If true connection is using a server IPv6 endpoint. More...
 
bool IsIPv6ToIPv4Bridged => this.SourceUsingIPv6 && this.LocalIPAddress.AddressFamily != AddressFamily.InterNetworkV6
 If true the client is being bridged (DNS64+NAT64), also SourceUsingIPv6. More...
 
ProtocolType ProtocolType => this.protocol.ProtocolType
 
- Static Public Attributes inherited from Photon.SocketServer.PeerBase
const int DefaultDisconnectInterval = 5_000
 
- Static Protected Member Functions inherited from Photon.SocketServer.PeerBase
static bool NeedSendErrorLog (SendResult sendResult)
 
- Protected Attributes inherited from Photon.SocketServer.PeerBase
readonly object SyncRoot = new object()
 object for synchronization More...
 
CustomTypeCache privateCustomTypeCache
 
PeerMetaDataContext metaDataContext
 
- Static Protected Attributes inherited from Photon.SocketServer.PeerBase
static readonly ILogger sendErrorLog = LogManager.GetLogger("Photon.ErrorLog.PeerSendError")
 
- Properties inherited from Photon.SocketServer.PeerBase
ConnectionState ConnectionState [get, set]
 Gets the ConnectionState for this instance. More...
 
string LocalIP [get]
 Gets the IP the client connects to. More...
 
int LocalPort [get]
 Gets the port the client connects to. More...
 
NetworkProtocolType NetworkProtocol [get]
 Gets the network protocol type used by the peer. More...
 
IRpcProtocol Protocol [get, set]
 Gets the used IRpcProtocol protocol. More...
 
string RemoteIP [get]
 Gets the client's remote IP address. More...
 
int RemotePort [get]
 Gets the port the client connects from. More...
 
int RoundTripTime [get, protected set]
 Gets the last round trip time for this peer. More...
 
int RoundTripTimeVariance [get, protected set]
 Gets the last round trip time variance for this peer. More...
 
int NumFailures [get, protected set]
 
bool SourceUsingIPv6 [get]
 If true the peer is using IPv6 to connect to the server, if the server endpoint used is not IPv6 (LocalIPAddressIsIPv6) it means the client is being bridged (DNS64+NAT64), also IsIPv6ToIPv4Bridged. More...
 
bool ClientUsingDebugLib [get]
 
byte SdkId [get]
 
byte PlatformId [get]
 
Version ClientVersion [get, protected set]
 
DateTime CreationTime = DateTime.Now [get]
 
PeerType PeerType [get]
 Under laying native peer type More...
 
InboundController PrivateInboundController [get]
 
int LastErrorCode [get]
 last error code that we was sent/set though this peer More...
 

Detailed Description

Server2Server peer for establishing server 2 server connection

Constructor & Destructor Documentation

◆ OutboundS2SPeer() [1/2]

Photon.SocketServer.ServerToServer.OutboundS2SPeer.OutboundS2SPeer ( ApplicationBase  application)
inlineprotected

◆ OutboundS2SPeer() [2/2]

Photon.SocketServer.ServerToServer.OutboundS2SPeer.OutboundS2SPeer ( ApplicationBase  application,
IRpcProtocol  protocol 
)
inlineprotected

Member Function Documentation

◆ ConnectTcp() [1/3]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectTcp ( IPEndPoint  remoteEndPoint,
string  applicationName,
bool  useMux = false,
IRpcProtocol  protocol = null 
)
inline

◆ ConnectTcp() [2/3]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectTcp ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
bool  useMux = false,
IRpcProtocol  protocol = null 
)
inline

◆ ConnectTcp() [3/3]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectTcp ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
byte[]  token,
IRpcProtocol  protocol = null 
)
inline

◆ ConnectToServerUdp() [1/4]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerUdp ( IPEndPoint  remoteEndPoint,
string  applicationName,
byte  numChannels,
short?  mtu 
)
inline

◆ ConnectToServerUdp() [2/4]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerUdp ( IPEndPoint  remoteEndPoint,
string  applicationName,
byte  numChannels,
short?  mtu,
IRpcProtocol  protocol,
bool  useInitV3 
)
inline

◆ ConnectToServerUdp() [3/4]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerUdp ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
byte  numChannels,
short?  mtu 
)
inline

◆ ConnectToServerUdp() [4/4]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerUdp ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
byte[]  token,
byte  numChannels,
short?  mtu,
IRpcProtocol  protocol = null 
)
inline

◆ ConnectToServerWebRTC()

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerWebRTC ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
IRpcProtocol  protocol,
byte[]  token = null 
)
inline

◆ ConnectToServerWebSocket() [1/2]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerWebSocket ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
WebSocketVersion  webSocketVersion,
IRpcProtocol  protocol 
)
inline

◆ ConnectToServerWebSocket() [2/2]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerWebSocket ( IPEndPoint  remoteEndPoint,
string  applicationName,
WebSocketVersion  webSocketVersion,
IRpcProtocol  protocol 
)
inline

◆ ConnectToServerWebSocketHixie76() [1/2]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerWebSocketHixie76 ( IPEndPoint  remoteEndPoint,
string  applicationName,
object  customInitObject,
string  origin,
byte[]  token = null 
)
inline

◆ ConnectToServerWebSocketHixie76() [2/2]

bool Photon.SocketServer.ServerToServer.OutboundS2SPeer.ConnectToServerWebSocketHixie76 ( IPEndPoint  remoteEndPoint,
string  applicationName,
string  origin 
)
inline

◆ Dispose()

override void Photon.SocketServer.ServerToServer.OutboundS2SPeer.Dispose ( bool  disposing)
inlineprotectedvirtual

Disposes the internal fibers.

Parameters
disposingTrue if called from Dispose().

Reimplemented from Photon.SocketServer.PeerBase.

◆ InitUdpEncryption()

void Photon.SocketServer.ServerToServer.OutboundS2SPeer.InitUdpEncryption ( byte[]  encryptSecret,
byte[]  authSecret,
uint[]  initSeqNums 
)
inline

◆ OnConnectionEstablished() [1/2]

virtual void Photon.SocketServer.ServerToServer.OutboundS2SPeer.OnConnectionEstablished ( InitV3Response  initResponse)
inlineprotectedvirtual

◆ OnConnectionEstablished() [2/2]

abstract void Photon.SocketServer.ServerToServer.OutboundS2SPeer.OnConnectionEstablished ( object  responseObject)
protectedpure virtual

◆ OnConnectionFailed()

abstract void Photon.SocketServer.ServerToServer.OutboundS2SPeer.OnConnectionFailed ( int  errorCode,
string  errorMessage 
)
protectedpure virtual

◆ SetClientVersion()

void Photon.SocketServer.ServerToServer.OutboundS2SPeer.SetClientVersion ( Version  version)
inline