Proud::INetServerEvent Class Referenceabstract
Inheritance diagram for Proud::INetServerEvent:

Public Member Functions

virtual void OnClientJoin (CNetClientInfo *clientInfo)=0
 
virtual void OnClientLeave (CNetClientInfo *clientInfo, ErrorInfo *errorinfo, const ByteArray &comment)=0
 
virtual void OnClientOffline (CRemoteOfflineEventArgs &)
 
virtual void OnClientOnline (CRemoteOnlineEventArgs &)
 
virtual bool OnConnectionRequest (AddrPort, ByteArray &, ByteArray &)
 
virtual void OnP2PGroupJoinMemberAckComplete (HostID groupHostID, HostID memberHostID, ErrorType result)=0
 
virtual void OnUserWorkerThreadBegin ()=0
 
virtual void OnUserWorkerThreadEnd ()=0
 
virtual void OnClientHackSuspected (HostID, HackType)
 
virtual void OnP2PGroupRemoved (HostID)
 
- 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 CNetServer

Usage

  • Realize this object
  • Pass to CLanServer as a parmeter.

Member Function Documentation

virtual void Proud::INetServerEvent::OnClientHackSuspected ( HostID  ,
HackType   
)
inlinevirtual

TODO:translate needed. This method is called when there is suspicion that the client has been hacked.

Parameters
clinetIDHostID of the client under suspicion
hackTypeType of hacking.
virtual void Proud::INetServerEvent::OnClientJoin ( CNetClientInfo clientInfo)
pure virtual

Event that occurs when client attempts to connect

  • Only called back for the client that received access permission from OnConnectionRequest
    Parameters
    clientInfoclient requested to connect
virtual void Proud::INetServerEvent::OnClientLeave ( CNetClientInfo clientInfo,
ErrorInfo errorinfo,
const ByteArray comment 
)
pure virtual

Event that occurs when client terminates connection

Parameters
clientInfoclient info that is disconnected
errorInfodisconnection info of client that is disconneced ErrorInfo.m_type value shows how disconnection processed Please refer ErrorInfo help section.
commenttext string sent by client via parameter comment of CNetClient.Disconnect
virtual void Proud::INetServerEvent::OnClientOffline ( CRemoteOfflineEventArgs )
inlinevirtual

A callback occurs when the client is disconnected. A callback occurs for OnClientLeave if reconnection does not occur. (The particular function shall have NetConnectionParam.m_enableAutoConnectionRecovery of NetClient as “True”)

Parameters
arsIt contains information on a disconnected client.
virtual void Proud::INetServerEvent::OnClientOnline ( CRemoteOnlineEventArgs )
inlinevirtual

A callback occurs when the client is disconnected and then reconnected. (The particular function shall have NetConnectionParam.m_enableAutoConnectionRecovery of NetClient as “True”)

Parameters
argsIt contains information on a reconnected client.
virtual bool Proud::INetServerEvent::OnConnectionRequest ( AddrPort  ,
ByteArray ,
ByteArray  
)
inlinevirtual

Event called back when client attempts to connect to server for the first time

  • This event is where to decide if server accepts the attempt or not If refused then client fails to connect to server and client receives ErrorType_NotifyServerDeniedConnection. If accepted then client succeeds to connect to server and a new HostID will be allocated to client. This is when OnClientJoin event is called back to server

Note

  • NEVER! to send/receive user logon info(user account name and/or password) in here. That is because the custom data from cliet to server is not encrypted.
Parameters
clientAddrInternet address of client
userDataFromClientThe custom data from client This value is the value that was entered at parameter CNetConnectionParam::m_userData when client was connected to server.
replyIf this event callback fills a value to this field then client will receive the result of connection to server from INetClientEvent::OnJoinServerComplete.
Returns
If to accept the connection reqeust from client then this function should return true.
virtual void Proud::INetServerEvent::OnP2PGroupJoinMemberAckComplete ( HostID  groupHostID,
HostID  memberHostID,
ErrorType  result 
)
pure virtual

The event that occurs when the process adding a new member to P2P Group is completed in all client

  • Assuming that there are existing member M1, M2 and M3 in group G and we try to add a new member M4. Even if M4 is added by JoinP2PGroup(), the process is not to be completed immediately. This is because each client M1, M2 and M3 did not yet receive the report(INetClientEvent.OnP2PMemberJoin) that 'M4 is added', and M4 did not yet receive the report(INetClientEvent.OnP2PMemberJoin) that M4 is added to M1, M2, M3 and M4. This event, for M4, occurs only after server acknowledges that M1, M2, M3 and M4 received necesary info.
  • The event also occurs for CreateP2PGroup.
Parameters
groupHostIDHostId of group
memberHostIDHostID of group member
resultIf ErrorType_Ok then it means successfully added, if ErrorType_AlreadyExists then it is a member that already in group. (does not mean it falied to) If has other values then it means failed to add. For an example, Case1. Calling CNetServer.LeaveP2PGroup or CNetServer.DestroyP2PGroup between the moment after calling CNetServer.CreateP2PGroup or CNetServer.JoinP2PGroup and the moment before this callback occurs, OR Case2. the client was terminating its connection to server at the same time, For each case, an other value can enter here.
virtual void Proud::INetServerEvent::OnP2PGroupRemoved ( HostID  )
inlinevirtual

This method is called right after P2P group is removed.

virtual void Proud::INetServerEvent::OnUserWorkerThreadBegin ( )
pure virtual

This method is called when thread of user work thread pool starts.

virtual void Proud::INetServerEvent::OnUserWorkerThreadEnd ( )
pure virtual

This method is called when thread of user work thread pool terminates.