Proud::INetClientEvent Class Referenceabstract
Inheritance diagram for Proud::INetClientEvent:

Public Member Functions

virtual void OnJoinServerComplete (ErrorInfo *info, const ByteArray &replyFromServer)=0
 
virtual void OnLeaveServer (ErrorInfo *errorInfo)=0
 
virtual void OnP2PMemberJoin (HostID memberHostID, HostID groupHostID, int memberCount, const ByteArray &message)=0
 
virtual void OnP2PMemberLeave (HostID memberHostID, HostID groupHostID, int memberCount)=0
 
virtual void OnChangeP2PRelayState (HostID remoteHostID, ErrorType reason)=0
 
virtual void OnServerOffline (CRemoteOfflineEventArgs &)
 
virtual void OnServerOnline (CRemoteOnlineEventArgs &)
 
virtual void OnP2PMemberOffline (CRemoteOfflineEventArgs &)
 
virtual void OnP2PMemberOnline (CRemoteOnlineEventArgs &)
 
virtual void OnChangeServerUdpState (ErrorType)
 
virtual void OnSynchronizeServerTime ()=0
 
- Public Member Functions inherited from Proud::INetCoreEvent
virtual void OnError (ErrorInfo *errorInfo)=0
 
virtual void OnWarning (ErrorInfo *errorInfo)=0
 
virtual void OnInformation (ErrorInfo *errorInfo)=0
 
virtual void OnException (const Exception &e)=0
 
virtual void OnNoRmiProcessed (RmiID rmiID)=0
 
virtual PROUD_API void OnReceiveUserMessage (HostID sender, const RmiContext &rmiContext, uint8_t *payload, int payloadLength)
 
virtual void OnTick (void *)
 
virtual void OnUserWorkerThreadCallbackBegin (CUserWorkerThreadCallbackContext *)
 
virtual void OnUserWorkerThreadCallbackEnd (CUserWorkerThreadCallbackContext *)
 

Detailed Description

Event sink for CNetClient

Usage

  • Realize this object.
  • Passed as a parameter to CNetClient

Member Function Documentation

virtual void Proud::INetClientEvent::OnChangeP2PRelayState ( HostID  remoteHostID,
ErrorType  reason 
)
pure virtual

This method is called at the moment the connection status to other client via P2P (relay or not) changes. Since it is called after the change so it is ok to call CNetClient.GetPeerInfo to view the value of CNetPeerInfo.Proud.CNetPeerInfo.m_RelayedP2P. P2P performance of ProudNet

Parameters
remoteHostIDHostID of other peer that is connected via P2P
reasonIf the P2P connection is successful then contains ErrorType_Ok. For other values it contain 'why the connection changed to relay'.
virtual void Proud::INetClientEvent::OnChangeServerUdpState ( ErrorType  )
inlinevirtual

This method is called at the moment that the communication status of UDP communication with server change.

Parameters
reasonIf ErrorType_Ok then UDP communication with server is normal and unreliable RMI messaging goes to server via UDP. Having other values means UDP communication witer server is unavailable and during this state, unreliable RMI messaging goes to server via TCP.
virtual void Proud::INetClientEvent::OnJoinServerComplete ( ErrorInfo info,
const ByteArray replyFromServer 
)
pure virtual

Event that occurs after arrival of the result of attempt to connect to server through CNetServer.Connect

Parameters
infoobject that contains the result of connection to server. ErrorInfo.m_type has success value when it is successful. View this value when connection attempt to server failed. Please refer ErrorInfo class description.
replyFromServerAdditional message from server. This value is from INetServerEvent.OnConnectionRequest.
virtual void Proud::INetClientEvent::OnLeaveServer ( ErrorInfo errorInfo)
pure virtual

Event that occurs when server connection is terminated

  • This event also occurs when client terminates the connection to server. However, it will be called back if the thread where NetClient.FrameMove is called and NetClient.Disconnect is called are same.
    Parameters
    errorInfoContains the reason why the connection was terminated. Please refer ErrorInfo.
virtual void Proud::INetClientEvent::OnP2PMemberJoin ( HostID  memberHostID,
HostID  groupHostID,
int  memberCount,
const ByteArray message 
)
pure virtual

This method is to be called back either when P2P Group is created or when a new member is added to P2P group. Also called for local host iteself.

For an example, if B enters into group G which already has client A in it, then A receives (B,G) and B recieves (A,G) and (B,G).

Parameters
memberHostIDHostID of itself or other peer
groupHostIDHostID of P2P group
memberCountThe number of menebers after being processed
messageThe custom data entered by user via either CNetServer.CreateP2PGroup or CNetServer.JoinP2PGroup will be passed onto here as they are.
virtual void Proud::INetClientEvent::OnP2PMemberLeave ( HostID  memberHostID,
HostID  groupHostID,
int  memberCount 
)
pure virtual

This method is to be called back either when P2P Group is created or when a peer withdraws. Also called for local host iteself.

Parameters
memberHostIDHostID of itself or other peer
groupHostIDHostID of P2P group
memberCountThe number of members after processed
virtual void Proud::INetClientEvent::OnP2PMemberOffline ( CRemoteOfflineEventArgs )
inlinevirtual

When other peers within the P2P group where it belongs to lost connection to the server, a callback occurs. (The particular function shall have NetConnectionParam.m_enableAutoConnectionRecovery of NetClient as “True”)

Parameters
argsIt has information on the peers that have lost connection.
virtual void Proud::INetClientEvent::OnP2PMemberOnline ( CRemoteOnlineEventArgs )
inlinevirtual

When other peers within the P2P group where it belongs to lost connection to the server and then gains reconnection, a callback occurs. (The particular function shall have NetConnectionParam.m_enableAutoConnectionRecovery of NetClient as “True”)

Parameters
argsIt contains information of the peer reconnected.
virtual void Proud::INetClientEvent::OnServerOffline ( CRemoteOfflineEventArgs )
inlinevirtual

When connection to the server is lost, a callback is called. After the callback is called for a particular event, if reconnection to the server is not established, a callback occurs for OnLeaveServer. (The particular function shall have NetConnectionParam.m_enableAutoConnectionRecovery of NetClient as “True”)

Parameters
argsWhen connection is lost, it has a variety of information.
virtual void Proud::INetClientEvent::OnServerOnline ( CRemoteOnlineEventArgs )
inlinevirtual

After connection to the server is lost and then established again, a callback occurs. (The particular function shall have NetConnectionParam.m_enableAutoConnectionRecovery of NetClient as “True”)

Parameters
argsIt has information on reconnection.
virtual void Proud::INetClientEvent::OnSynchronizeServerTime ( )
pure virtual

Called every time when time is synchronized with server Server time sybchronization becomes more accurate with as frequency of calling this method increases. It is also possible to call GetServerTimeMs() within this metod.