Proud::CNetServer Class Referenceabstract

Gaming network server. More...

Inheritance diagram for Proud::CNetServer:

Public Member Functions

virtual bool CloseConnection (HostID clientHostID)=0
 
virtual void CloseEveryConnection ()=0
 
virtual HostID CreateP2PGroup (const HostID *clientHostIDs, int count, ByteArray message=ByteArray(), CP2PGroupOption &option=CP2PGroupOption::Default, HostID assignedHostID=HostID_None)=0
 
HostID CreateP2PGroup (ByteArray message=ByteArray(), CP2PGroupOption &option=CP2PGroupOption::Default, HostID assignedHostID=HostID_None)
 
HostID CreateP2PGroup (HostID memberID, ByteArray message=ByteArray(), CP2PGroupOption &option=CP2PGroupOption::Default, HostID assignedHostID=HostID_None)
 
virtual bool DestroyP2PGroup (HostID groupHostID)=0
 
virtual void DestroyEmptyP2PGroups ()=0
 
virtual String DumpGroupStatus ()=0
 
virtual int GetClientCount ()=0
 
virtual void GetStats (CNetServerStats &outVal)=0
 
virtual int GetClientHostIDs (HostID *output, int outputLength)=0
 
virtual bool GetJoinedP2PGroups (HostID clientHostID, HostIDArray &output)=0
 
double GetLastPingSec (HostID clientID, ErrorType *error=NULL)
 
virtual int GetLastUnreliablePingMs (HostID clientID, ErrorType *error=NULL)=0
 
double GetRecentPingSec (HostID clientID, ErrorType *error=NULL)
 
virtual int GetRecentUnreliablePingMs (HostID clientID, ErrorType *error=NULL)=0
 
virtual int GetP2PRecentPingMs (HostID HostA, HostID HostB)=0
 
virtual bool GetP2PGroupInfo (HostID groupHostID, CP2PGroup &output)=0
 
virtual bool IsValidHostID (HostID id)=0
 
virtual void GetP2PGroups (CP2PGroups &output)=0
 
virtual int GetP2PGroupCount ()=0
 
virtual bool GetClientInfo (HostID clientHostID, CNetClientInfo &output)=0
 
virtual bool IsConnectedClient (HostID clientHostID)=0
 
PN_DEPRECATED bool GetPeerInfo (HostID clientHostID, CNetClientInfo &output)
 
virtual bool SetHostTag (HostID hostID, void *hostTag)=0
 
virtual int64_t GetTimeMs ()=0
 
virtual bool JoinP2PGroup (HostID memberHostID, HostID groupHostID, ByteArray message=ByteArray())=0
 
virtual bool LeaveP2PGroup (HostID memberHostID, HostID groupHostID)=0
 
virtual void SetEventSink (INetServerEvent *eventSink)=0
 
virtual void Start (CStartServerParameter &param)=0
 
virtual void Start (CStartServerParameter &param, ErrorInfoPtr &outError)=0
 
virtual void Stop ()=0
 
virtual void AllowEmptyP2PGroup (bool enable)=0
 
virtual bool IsEmptyP2PGroupAllowed () const =0
 
virtual void GetRemoteIdentifiableLocalAddrs (CFastArray< NamedAddrPort > &output)=0
 
virtual void GetTcpListenerLocalAddrs (CFastArray< AddrPort > &output)=0
 
virtual void GetUdpListenerLocalAddrs (CFastArray< AddrPort > &output)=0
 
virtual void SetDefaultTimeoutTimeMs (int newValInMs)=0
 
virtual void SetTimeoutTimeMs (HostID host, int newValInMs)=0
 
virtual void SetDefaultAutoConnectionRecoveryTimeoutTimeMs (int newValInMs)=0
 
virtual void SetAutoConnectionRecoveryTimeoutTimeMs (HostID host, int newValInMs)=0
 
virtual void SetDefaultFallbackMethod (FallbackMethod newValue)=0
 
virtual void EnableLog (const PNTCHAR *logFileName)=0
 
virtual void DisableLog ()=0
 
virtual void SetSpeedHackDetectorReckRatioPercent (int newValue)=0
 
virtual bool EnableSpeedHackDetector (HostID clientID, bool enable)=0
 
virtual void SetMessageMaxLength (int value_s, int value_c)=0
 
virtual bool IsNagleAlgorithmEnabled ()=0
 
virtual void SetMaxDirectP2PConnectionCount (HostID clientID, int newVal)=0
 
virtual bool SetDirectP2PStartCondition (DirectP2PStartCondition newVal)=0
 
virtual HostID GetMostSuitableSuperPeerInGroup (HostID groupID, const CSuperPeerSelectionPolicy &policy=CSuperPeerSelectionPolicy::GetOrdinary(), const HostID *excludees=NULL, intptr_t excludeesLength=0)=0
 
virtual HostID GetMostSuitableSuperPeerInGroup (HostID groupID, const CSuperPeerSelectionPolicy &policy, HostID excludee)=0
 
virtual int GetSuitableSuperPeerRankListInGroup (HostID groupID, SuperPeerRating *ratings, int ratingsBufferCount, const CSuperPeerSelectionPolicy &policy=CSuperPeerSelectionPolicy::GetOrdinary(), const CFastArray< HostID > &excludees=CFastArray< HostID >())=0
 
virtual void GetUdpSocketAddrList (CFastArray< AddrPort > &output)=0
 
virtual int GetInternalVersion ()=0
 
virtual bool GetP2PConnectionStats (HostID remoteHostID, CP2PConnectionStats &status)=0
 
virtual bool GetP2PConnectionStats (HostID remoteA, HostID remoteB, CP2PPairConnectionStats &status)=0
 
virtual void GetUserWorkerThreadInfo (CFastArray< CThreadInfo > &output)=0
 
virtual void GetNetWorkerThreadInfo (CFastArray< CThreadInfo > &output)=0
 
virtual bool SendUserMessage (const HostID *remotes, int remoteCount, RmiContext &rmiContext, uint8_t *payload, int payloadLength)=0
 
bool SendUserMessage (HostID remote, RmiContext &rmiContext, uint8_t *payload, int payloadLength)
 
virtual ErrorType SetCoalesceIntervalMs (HostID remote, int intervalMs)=0
 
 
virtual ErrorType SetCoalesceIntervalToAuto (HostID remote)=0
 
 
virtual void TEST_SetOverSendSuspectingThresholdInBytes (int newVal)=0
 
virtual void TEST_SetTestping (HostID hostID0, HostID hostID1, int ping)=0
 
virtual void TEST_ForceDenyTcpConnection ()=0
 
virtual ErrorType GetUnreliableMessagingLossRatioPercent (HostID remotePeerID, int *outputPercent)=0
 
- Public Member Functions inherited from Proud::IRmiHost
virtual void AttachProxy (IRmiProxy *proxy)=0
 
void AttachProxy (IRmiProxy *proxy, ErrorInfoPtr &outError)
 
virtual void AttachStub (IRmiStub *stub)=0
 
void AttachStub (IRmiStub *stub, ErrorInfoPtr &outError)
 
virtual void DetachProxy (IRmiProxy *proxy)=0
 
void DetachProxy (IRmiProxy *proxy, ErrorInfoPtr &outError)
 
virtual void DetachStub (IRmiStub *stub)=0
 
void DetachStub (IRmiStub *stub, ErrorInfoPtr &outError)
 
virtual void SetTag (void *value)=0
 
virtual void * GetTag ()=0
 
virtual bool RunAsyncInternal (HostID taskOwner, LambdaBase_Param0< void > *func)=0
 
virtual bool IsSimplePacketMode ()=0
 
virtual void ShowError_NOCSLOCK (ErrorInfoPtr errorInfo)=0
 
virtual void ShowNotImplementedRmiWarning (const PNTCHAR *RMIName)=0
 
virtual void PostCheckReadMessage (CMessage &msg, const PNTCHAR *RMIName)=0
 
virtual CriticalSectionGetCriticalSection ()=0
 

Static Public Member Functions

static CNetServerCreate ()
 

Public Attributes

LambdaBaseHolder_Param1< void,
CNetClientInfo * > 
OnClientJoin
 See Proud.INetServerEvent.OnClientJoin for details.
 
LambdaBaseHolder_Param3< void,
CNetClientInfo *, ErrorInfo
*, const ByteArray & > 
OnClientLeave
 See Proud.INetServerEvent.OnClientLeave for details.
 
LambdaBaseHolder_Param2< void,
HostID, HackType
OnClientHackSuspected
 See Proud.INetServerEvent.OnClientHackSuspected for details.
 
LambdaBaseHolder_Param1< void,
CRemoteOfflineEventArgs & > 
OnClientOffline
 See Proud.INetServerEvent.OnClientOffline for details.
 
LambdaBaseHolder_Param1< void,
CRemoteOnlineEventArgs & > 
OnClientOnline
 See Proud.INetServerEvent.OnClientOnline for details.
 
LambdaBaseHolder_Param4< void,
AddrPort, ByteArray
&, ByteArray &, bool * > 
OnConnectionRequest
 See Proud.INetServerEvent.OnConnectionRequest for details.
 
LambdaBaseHolder_Param3< void,
HostID, HostID, ErrorType > 
OnP2PGroupJoinMemberAckComplete
 See Proud.INetServerEvent.OnP2PGroupJoinMemberAckComplete for details.
 
LambdaBaseHolder_Param1< void,
HostID
OnP2PGroupRemoved
 See Proud.INetServerEvent.OnP2PGroupRemoved for details.
 
LambdaBaseHolder_Param0< void > OnUserWorkerThreadBegin
 See Proud.INetServerEvent.OnUserWorkerThreadBegin for details.
 
LambdaBaseHolder_Param0< void > OnUserWorkerThreadEnd
 See Proud.INetServerEvent.OnUserWorkerThreadEnd for details.
 
- Public Attributes inherited from Proud::HasCoreEventFunctionObjects
LambdaBaseHolder_Param1< void,
ErrorInfo * > 
OnError
 See Proud.INetCoreEvent.OnError for details.
 
LambdaBaseHolder_Param1< void,
const Exception & > 
OnException
 See Proud.INetCoreEvent.OnException for details.
 
LambdaBaseHolder_Param1< void,
ErrorInfo * > 
OnInformation
 See Proud.INetCoreEvent.OnInformation for details.
 
LambdaBaseHolder_Param1< void,
RmiID > 
OnNoRmiProcessed
 See Proud.INetCoreEvent.OnNoRmiProcessed for details.
 
LambdaBaseHolder_Param4< void,
HostID, const RmiContext
&, uint8_t *, int > 
OnReceiveUserMessage
 See Proud.INetCoreEvent.OnReceiveUserMessage for details.
 
LambdaBaseHolder_Param1< void,
ErrorInfo * > 
OnWarning
 See Proud.INetCoreEvent.OnWarning for details.
 
LambdaBaseHolder_Param1< void,
void * > 
OnTick
 See Proud.INetCoreEvent.OnTick for details.
 
LambdaBaseHolder_Param0< void > OnUserWorkerThreadCallbackBegin
 See Proud.INetCoreEvent.OnUserWorkerThreadCallbackBegin for details.
 
LambdaBaseHolder_Param0< void > OnUserWorkerThreadCallbackEnd
 See Proud.INetCoreEvent.OnUserWorkerThreadCallbackEnd for details.
 

Additional Inherited Members

- Protected Member Functions inherited from Proud::IRmiHost
virtual bool Send (const CSendFragRefs &sendData, const SendOpt &sendContext, const HostID *sendTo, int numberOfsendTo, int &compressedPayloadLength)=0
 

Detailed Description

Gaming network server.

A network server for gaming. Please refer to ProudNet Server.

  • Can be used for a MMO title
  • Receives CNetClient connection
  • Allocates HostID to client
  • Allows RMI requires HostID
  • Basic options are set in order to support what a general game server needs
  • Supports P2P connection between clients. This server object supports to be a rela server when P2P connection fails between clients.

General usage

Creating P2P connection group

  • The client connected to CNetServer can create 1 or more P2P group. Among the clients linked as P2P group can transmit/receive RMI as HostID being index.
  • Creating/removing a new P2P group: Only server has rights. OnP2PMemberJoin and so on will be called at client via CreateP2PGroup(),DestroyP2PGroup().
  • Adding/removig peer to/from existing P2P group: JoinP2PGroup(), LeaveP2PGroup(). OnP2PMemberJoin and so on will be called at client.

Roles as relay server

  • As long as using HostID, P2P connection occurs virtually as well. For an example, even if the opponent is a member of P2P group, between clients that P2P connection was not successful in real then RMI is successfully sent to opponent's HostID. Relay server manages the carrying. Tough for same RMI reception message, it is to read RmiContext.m_relayed at RMI read part to get whether went through relay server.

Thread pooling

  • Basically uses thread pool. So there must be at least 1 or more thread when server starts.
  • When turning thread pooling off is better: server with 1 CPU and all it does is CPU time process (e.g. relay server)
  • When turning thread pooling on is better: server with multip CPU or server that has often device time process (e.g. MMO game server)
  • Since thread pool function is called when CoInitialize()is ready there is no need to call CoInitialize() or CoUninitialize().

Server performance related to number of UDP host port

  • Can designate number of UDP host port as server port parameter of CNetServer.Start Client will be connected to one of the ports among parameter when connected to server.

Success rate of P2P direct communication note

  • Direct P2P communication will be successful when an end of P2P is real IP, Full-cone NAT.
  • When game server operatedbehind NAT it is necessary to enter server address to Start(). (Please refer Start() manual.) However, there will be no direct P2P communication between the client run by other host that is in front of game server and behind of NAT and the client of outer internet. This is because the internal IP of NAT will be recognized other than outer internet address by NAT device in server.

Member Function Documentation

virtual void Proud::CNetServer::AllowEmptyP2PGroup ( bool  enable)
pure virtual

Option to set P2P Group without member can be sustained. Default is true.

  • When set as true: Creating P2P group of 0 member will succeed when CreateP2PGroup is called. The P2P group of 0 member will sustain. In this case, user must call DestroyP2PGroup or DestroyEmptyP2PGroups to prevent the P2P group of 0 member to be left in server.
  • When set as false: Creating P2P group of 0 member will fail when CreateP2PGroup is called. If the number of P2P group becomes 0 then the P2P group will be destructed automatically.
virtual bool Proud::CNetServer::CloseConnection ( HostID  clientHostID)
pure virtual

Kicks out all clients in client group and/or chatting group

Returns
false if there is no realted client.
virtual void Proud::CNetServer::CloseEveryConnection ( )
pure virtual

Kicks out all clients

static CNetServer* Proud::CNetServer::Create ( )
inlinestatic

Creates new instance.

virtual HostID Proud::CNetServer::CreateP2PGroup ( const HostID clientHostIDs,
int  count,
ByteArray  message = ByteArray(),
CP2PGroupOption option = CP2PGroupOption::Default,
HostID  assignedHostID = HostID_None 
)
pure virtual

Generate a P2P Group.

Parameters
clientHostIDsThe member list of the P2P group to make clientHostIDs. HostID_Server is not possible as a member. When count=0, this value is ignored.
countThe number of array elements of clientHostIDs. If you input 0, it means it will generate a P2P group without a member.
Themessage to be sent to the related clients from the server when a P2P group is added. You can skip it.
Thisis an additional option that users want to designate during creation of a P2P group. You can skip it.
Youcan create a P2P group with the HostID users want. The default value is None. If you select None, it is automatically allocated. If you enter a HostID already being used, P2P group creation will fail and None can be returned.
Returns
HostID of the created P2P group. The type is HostID.
HostID Proud::CNetServer::CreateP2PGroup ( ByteArray  message = ByteArray(),
CP2PGroupOption option = CP2PGroupOption::Default,
HostID  assignedHostID = HostID_None 
)
inline

Create a P2P group without a member.

  • Group creation may fail depending on the AllowEmptyP2PGroup configuration.
    Parameters
    messageThis is the message sent to related clients from the server when adding a P2P group. You can skip it.
    Youcan create a P2P group with the HostID users want. The default value is None. If you select None, it is automatically allocated. If you enter a HostID already being used, P2P group creation will fail and None can be returned.
    Returns
    HostID of the created P2P group. The type is HostID.
HostID Proud::CNetServer::CreateP2PGroup ( HostID  memberID,
ByteArray  message = ByteArray(),
CP2PGroupOption option = CP2PGroupOption::Default,
HostID  assignedHostID = HostID_None 
)
inline

You can create a P2P group consisted of one member

Parameters
memberIDThe HostID of the member when joining the group for the first time.
messageThis is the message sent to related clients from the server when adding a P2P group. You can skip it.
Youcan create a P2P group with the HostID users want. The default value is None. If you select None, it is automatically allocated. If you enter a HostID already being used, P2P group creation will fail and None can be returned.
Returns
HostID of the created P2P group. The type is HostID.
virtual void Proud::CNetServer::DestroyEmptyP2PGroups ( )
pure virtual

Search all P2P Group that is created within server then destructs all P2P groups consist of 0 member.

virtual bool Proud::CNetServer::DestroyP2PGroup ( HostID  groupHostID)
pure virtual

Destructs P2P Group

  • All members within will receive an event(Proud.INetClientEvent.OnP2PMemberLeave) that they will be withdrawn from P2P group. Of course, the connection to server will be sustained.
    Parameters
    groupHostIDID of P2P group to be destructed
    Returns
    false if there is no P2P group related
virtual void Proud::CNetServer::DisableLog ( )
pure virtual

Turns off the log that is thrned on by EnableLog

virtual String Proud::CNetServer::DumpGroupStatus ( )
pure virtual

Returns internal status as text string. Useful when debugging.

virtual void Proud::CNetServer::EnableLog ( const PNTCHAR *  logFileName)
pure virtual

Turns on the option that leaves internal execution log as file

  • There are not many cases that require this function. Used to collect problems at Nettention.
  • Calling this function again while already 'EnableLog'ed, this function will not do anything. If you need to keep stacking the log with other file name the you must call DisableLog then call EnableLog.
    Parameters
    logFileNamelog file name
virtual bool Proud::CNetServer::EnableSpeedHackDetector ( HostID  clientID,
bool  enable 
)
pure virtual

Turns on/off speed hack detection function

Parameters
clientIDHostID of client that speed hack detection to be turned on/off
enablemust set true to turn on
Returns
True if found valid client, false if no related clients.
virtual int Proud::CNetServer::GetClientCount ( )
pure virtual

Gets the number of connected clients

virtual int Proud::CNetServer::GetClientHostIDs ( HostID output,
int  outputLength 
)
pure virtual

Gets client HostID list

  • The list acquired by this method is only a snapshot. After this function is returned, there is no guarantee that the contents in the list matche the status of real server. Therefore, in order to get precise client list, it is recommended to create and manage a separate client list needed by user at INetServerEvent.OnClientJoin, INetServerEvent.OnClientLeave.
    Parameters
    outputWhere HostID list to be filled
    outputLengthMaximum size of the list
    Returns
    The number of clause really filled
virtual bool Proud::CNetServer::GetClientInfo ( HostID  clientHostID,
CNetClientInfo output 
)
pure virtual

Gets the information of 1 peer connected to this object

Parameters
peerHostIDHostID of peer to find
outputInfoof foudn peer. Nothing will be filled when found nothing.
Returns
true when found
virtual int Proud::CNetServer::GetInternalVersion ( )
pure virtual

Gets engine protocol version. Connection will be rejected if this value is different to engine protocol version from client.

virtual bool Proud::CNetServer::GetJoinedP2PGroups ( HostID  clientHostID,
HostIDArray output 
)
pure virtual

Gets P2P group list of peer that is pointed by clientHostID

double Proud::CNetServer::GetLastPingSec ( HostID  clientID,
ErrorType *  error = NULL 
)
inline

(We recommend you to use StartRoundTripLatencyTest and GetRoundTripLatency rather than this function.) Gets the last latency of client.

Parameters
clientIDHostID of client to find
Returns
returns ping time in millisecond. Returns -1 when there is none.
virtual int Proud::CNetServer::GetLastUnreliablePingMs ( HostID  clientID,
ErrorType *  error = NULL 
)
pure virtual

Gets the last latency of client

Parameters
clientIDHostID of client to find
Returns
Returns ping time in millisecond.Returns -1 when there is none.
virtual HostID Proud::CNetServer::GetMostSuitableSuperPeerInGroup ( HostID  groupID,
const CSuperPeerSelectionPolicy policy = CSuperPeerSelectionPolicy::GetOrdinary(),
const HostID excludees = NULL,
intptr_t  excludeesLength = 0 
)
pure virtual

Finds the clients that can perform best as super peer When developing game of P2P Networking for Super Peer (Super Peer or host) format, this method finds and notifies the best possible super peer among members of the P2P group that is pointed by groupID.

  • There are possibilities that this method cannot find properly right after P2P group is eiter created or modified.
  • It will find more suitable super peer when called about 2 to 5 seconds after this method is called.
    Parameters
    groupIDfinds within this P2P Group
    policypolicy that designates super peer. Please refer CSuperPeerSelectionPolicy.
    exclusdeesSelects excluding the members within excludees among P2P Group that is pointed by groupID For an example, it is useful to prevent intentionally the super peer to be re-selected when the super peer wass once disqualified.
    Returns
    HostID of the best possible client as super peer. Returns HostID_None either when no P2P group was found or all filtered by excludees.
virtual HostID Proud::CNetServer::GetMostSuitableSuperPeerInGroup ( HostID  groupID,
const CSuperPeerSelectionPolicy policy,
HostID  excludee 
)
pure virtual

Please refer same name method.

virtual void Proud::CNetServer::GetNetWorkerThreadInfo ( CFastArray< CThreadInfo > &  output)
pure virtual

Gets the information of networking thread ProudNet has a thread that manages network I/O that is independent to Thread pool. This gets the information of the thread.

Parameters
outputthis is where the information is filled.
virtual bool Proud::CNetServer::GetP2PConnectionStats ( HostID  remoteHostID,
CP2PConnectionStats status 
)
pure virtual

Gets status statistics of all P2P connections related to designated target This method is useful to get the proportion of Direct P2P and relayed P2P.

Parameters
remoteHostIDHostID of client or P2P Group
  • If this is HostID of 1 client then this method returns connection statistics of other peers that the client is P2P communicating with.
  • If this is HostID of 1 P2Pgroup then this method returns the statistics of all P2P communications among all clients in the P2P group.
statusP2P connection related vairables are to be filled in here.
Returns
Returns true if remoteHostID is valid, false if not valid
virtual bool Proud::CNetServer::GetP2PConnectionStats ( HostID  remoteA,
HostID  remoteB,
CP2PPairConnectionStats status 
)
pure virtual

Return attempted number and succeed number of udp message between remoteA and remoteB

  • User can calculate udp loss rate based on it.
virtual int Proud::CNetServer::GetP2PGroupCount ( )
pure virtual

Gets the total number of opened P2P group.

virtual bool Proud::CNetServer::GetP2PGroupInfo ( HostID  groupHostID,
CP2PGroup output 
)
pure virtual

Gets the information of 1 P2P group

virtual void Proud::CNetServer::GetP2PGroups ( CP2PGroups output)
pure virtual

Gets all P2P group list

  • Makes a back up copy
virtual int Proud::CNetServer::GetP2PRecentPingMs ( HostID  HostA,
HostID  HostB 
)
pure virtual

Gets recent ping information between two peers

PN_DEPRECATED bool Proud::CNetServer::GetPeerInfo ( HostID  clientHostID,
CNetClientInfo output 
)
inline

Performs roles as GetClientInfo but not to be used any more. It is recommended to use GetClientInfo instead.

double Proud::CNetServer::GetRecentPingSec ( HostID  clientID,
ErrorType *  error = NULL 
)
inline

(We recommend you to use StartRoundTripLatencyTest and GetRoundTripLatency rather than this function.) Gets the recent latency of client.

Parameters
clientIDHostID of client to find
Returns
Returns ping time in millisecond. Returns -1 when there is none.
virtual int Proud::CNetServer::GetRecentUnreliablePingMs ( HostID  clientID,
ErrorType *  error = NULL 
)
pure virtual

(We recommend you to use StartRoundTripLatencyTest and GetRoundTripLatency rather than this function.) Gets the recent latency of client

Parameters
clientIDHostID of client to find
Returns
Returns ping time in millisecond.Returns -1 when there is none.
virtual void Proud::CNetServer::GetRemoteIdentifiableLocalAddrs ( CFastArray< NamedAddrPort > &  output)
pure virtual

Gets listening port address of the server that can be recognized by client

  • Returns values based on the server addresses that are received when server started. This is useful when using NAT or 2 or more LAN cards.
virtual void Proud::CNetServer::GetStats ( CNetServerStats outVal)
pure virtual

Gets server process statistics

virtual int Proud::CNetServer::GetSuitableSuperPeerRankListInGroup ( HostID  groupID,
SuperPeerRating ratings,
int  ratingsBufferCount,
const CSuperPeerSelectionPolicy policy = CSuperPeerSelectionPolicy::GetOrdinary(),
const CFastArray< HostID > &  excludees = CFastArrayHostID >() 
)
pure virtual

GetMostSuitableSuperPeerInGroup is the function to get the best possible P2P Networking for Super Peer (Super Peer or host). Provides not only the best possible super peer but also the list of the next to the best possible super peer as well The first clause of the list that this function returns is same as the super peer returned by GetMostSuitableSuperPeerInGroup.

Parameters
groupIDProvides the list of the best possible super peer among this P2P Group
ratingsThis is where the list of super peer will be filled. The best super peer is to be at the top as sorted.
ratingsBufferCountThe number of array clause of rating. The size of the array returned by this function does not fill more than this size.
policyPlease refer the same name parameter at GetMostSuitableSuperPeerInGroup.
excludeesPlease refer the same name parameter at GetMostSuitableSuperPeerInGroup.
Returns
the number of clause that is filled at ratings. Returns 0 either when no P2P group was found or filtered all of them by excludees.
virtual void Proud::CNetServer::GetTcpListenerLocalAddrs ( CFastArray< AddrPort > &  output)
pure virtual

Gets local address of TCP listener port. For an example, it is possible to acquire the listening port number of real server through this when the server ports are dynamically allocated.

virtual int64_t Proud::CNetServer::GetTimeMs ( )
pure virtual

Gets current time of server. Has almost same value as CNetClient.GetServerTimeMs().

virtual void Proud::CNetServer::GetUdpListenerLocalAddrs ( CFastArray< AddrPort > &  output)
pure virtual

Gets local address of UDP listener port. For an example, it is possible to acquire the listening port number of real server through this when the server ports are dynamically allocated.

virtual void Proud::CNetServer::GetUdpSocketAddrList ( CFastArray< AddrPort > &  output)
pure virtual

Gets UDP socket addresses that are prepared by server

virtual ErrorType Proud::CNetServer::GetUnreliableMessagingLossRatioPercent ( HostID  remotePeerID,
int *  outputPercent 
)
pure virtual

As unreliable messaging takes most of the entire traffic in common on-line games, we add the feature to get the traffic loss rate in the existing unreliable messaging feature. Packet loss rate measuring device

Parameters
remoteHostIDWhich loss rate with communication with which remote would be obtained. You can input anything, including your own peer, server, etc. If it is itself, it is 0%.
outputPercentThe packet loss rate is filled up in % unit (i.e., 0 to 100)
virtual void Proud::CNetServer::GetUserWorkerThreadInfo ( CFastArray< CThreadInfo > &  output)
pure virtual

Gets the information of each thread of Thread pool

Parameters
outputthis is where the information has filled in.
virtual bool Proud::CNetServer::IsConnectedClient ( HostID  clientHostID)
pure virtual

Checks if the client pointed by clientHostID is logged on

Returns
if found to be logged on client then returns true
virtual bool Proud::CNetServer::IsEmptyP2PGroupAllowed ( ) const
pure virtual

Gets option value to set P2P Group without member can be sustained.

Returns
Option value to set P2P Group without member can be sustained.
virtual bool Proud::CNetServer::IsNagleAlgorithmEnabled ( )
pure virtual
virtual bool Proud::CNetServer::IsValidHostID ( HostID  id)
pure virtual

Checks if HostID is valid

Parameters
idHostID to be used to check if valid
Returns
true then valid HsstID of client or server or P2P Group
virtual bool Proud::CNetServer::JoinP2PGroup ( HostID  memberHostID,
HostID  groupHostID,
ByteArray  message = ByteArray() 
)
pure virtual

Lets client memberHostID enter into existing P2P Group groupHostID

Parameters
memberHostIDHostID of member to join P2P group. Please refer How to include a server as a peer-to- peer group member to find out if HostID_Server can join.
groupHostIDHostID of existing P2P group
messageMessage to be sent to related clients from server when adding P2P group. Will be accepted as it is at INetClientEvent.OnP2PMemberJoin.
Returns
returns true if successful
virtual bool Proud::CNetServer::LeaveP2PGroup ( HostID  memberHostID,
HostID  groupHostID 
)
pure virtual

Client memberHostID lets P2P Group groupHostID go out

  • At the client being kicked out, INetClientEvent.OnP2PMemberLeave will be called one after another for all members of P2P group(including itself). On the other hand, INetClientEvent.OnP2PMemberLeave will be called for other members of P2P group that are to be kicked out.
  • For those of no members, in other words for an empty P2P group, they will be either auto-destructed by AllowEmptyP2PGroup setting or can be re-used after its survival.
Parameters
memberHostIDHostID of member to be kicked out
groupHostIDto be kicked out from which group?
Returns
returns true if successfully kicked out
virtual bool Proud::CNetServer::SendUserMessage ( const HostID remotes,
int  remoteCount,
RmiContext rmiContext,
uint8_t *  payload,
int  payloadLength 
)
pure virtual

Send user defined message. Please refer to Exchanging user-defined message without using RMI at all for more detail

Parameters
remotesReceiver array. You can put client, server(HostID_Server), P2P Group, etc like RMI.
remoteCountSize of receiver array
rmiContextAdditional information of sending. Please refer to Protocol type of ProudNet.
payloadMessage data for sending.
payloadLengthLength of sending message data. It is byte.
bool Proud::CNetServer::SendUserMessage ( HostID  remote,
RmiContext rmiContext,
uint8_t *  payload,
int  payloadLength 
)
inline

Sending user defined message. Please refer to Exchanging user-defined message without using RMI at all for more detail.

Parameters
remotereceiver
rmiContextAdditional information of sending. Please refer to Protocol type of ProudNet.
payloadMessage data for sending.
payloadLengthLength of sending message data. It is byte.
virtual void Proud::CNetServer::SetAutoConnectionRecoveryTimeoutTimeMs ( HostID  host,
int  newValInMs 
)
pure virtual

If m_enableAutoConnectionRecovery is true, The time of TimeOut is not valid. So, You should set the ACR time by using this method.

  • It may take some seconds to apply the time out value change.
  • You can use it regardless of before or after starting the server.
  • Applied to specific host(client).
  • It may take some seconds to apply the time out value change.
virtual ErrorType Proud::CNetServer::SetCoalesceIntervalMs ( HostID  remote,
int  intervalMs 
)
pure virtual

ProudNet2 모듈에서 호출됩니다. 여러분은 사용하지 마세요.Manually set coalesce interval. Use this function if you do not satisfy to the quality of coalesce feature of ProudNet. Inapprpriate use of this function may cause unexpected behavior, so care must be taken.

virtual ErrorType Proud::CNetServer::SetCoalesceIntervalToAuto ( HostID  remote)
pure virtual

Coalesce interval set to automatic. This is default.

virtual void Proud::CNetServer::SetDefaultAutoConnectionRecoveryTimeoutTimeMs ( int  newValInMs)
pure virtual

If m_enableAutoConnectionRecovery is true, The time of TimeOut is not valid. So, You should set the ACR time by using this method.

  • Default is 60 * 1000. ( 1 minute )
virtual void Proud::CNetServer::SetDefaultFallbackMethod ( FallbackMethod  newValue)
pure virtual

The method to set limits to how far the client uses UDP communication

  • This method can be used to block UDP communication between client and server or client and peer due to intentional reason by user.
  • The worst case, for an example, if there occurs a serious UDP communication hurdle at a server then the problem can be temporarily reduced by turning this option up. However, since UDP communication is crucial to game service so it is recommended to solve the problems ASAP then thrun this option back on.
  • Only applied to those newly connected clients after this value is changed
  • The initial status is FallbackMethod_None.
Parameters
newValuea limitation policy. Proud.FallbackMethod_CloseUdpSocket cannot be used.
virtual void Proud::CNetServer::SetDefaultTimeoutTimeMs ( int  newValInMs)
pure virtual

Sets the critical value of time out(millisecond) to disconnect the connection with server when it has been long not communicating with it

virtual bool Proud::CNetServer::SetDirectP2PStartCondition ( DirectP2PStartCondition  newVal)
pure virtual

Designates the condition to begin P2P hole-punching among clients JIT(Just-in-time) P2P connection

  • The clients that the designated value will be applied to are the client that connected after this method is called.
  • Default is the value that is designated at Proud.CNetConfig.DefaultDirectP2PStartCondition.
Parameters
newValthe condition to begin P2P hole-punching among clients
Returns
returns true if successfully applied
virtual void Proud::CNetServer::SetEventSink ( INetServerEvent eventSink)
pure virtual

Sets an object that can receive event

  • Can set only 1 object
  • This method can only be called before client attempts to connect to server. Otherwise, an execption will be 'throw'n.
virtual bool Proud::CNetServer::SetHostTag ( HostID  hostID,
void *  hostTag 
)
pure virtual

Designates tag to each of other hosts(clients for servers, peers for clients) that are connected to this host. A User-defined data(Tag) for each host function.

  • Can designate tag to itself(server or client)
virtual void Proud::CNetServer::SetMaxDirectP2PConnectionCount ( HostID  clientID,
int  newVal 
)
pure virtual

Designates the maximum number of Direct P2P connections that the desinated clients can be connected to

  • Those other P2P connections that have values that exceed the designated value will always be relayed.
  • Actual number of P2P connections may be less than newVal due to JIT(Just-in-time) P2P connection, but it is not a problem.
virtual void Proud::CNetServer::SetMessageMaxLength ( int  value_s,
int  value_c 
)
pure virtual

To stop the damaged message header sent by a hacked client(especially the size part), it is crucial to set the maximum size of messages received by server. This method sets the limit and the default value is 64KB.

Parameters
value_sserverMessageMaxLength
value_cclientMessageMaxLength
virtual void Proud::CNetServer::SetSpeedHackDetectorReckRatioPercent ( int  newValue)
pure virtual

Set the intensity of speed hack detection

  • Sets between the value of 0 and 100. Closer to 100 detects with more intensity.
  • The speed hack detection function of ProudNet operates based on ping among servers and time stamp values. Using the value closer to 0 provides less time taken for detection but those clients with inconsistant ping can be detected as a speed hack.
  • Initial value is 100.
  • Changed value will be applied to clients connected after the intensity is changed.
virtual void Proud::CNetServer::SetTimeoutTimeMs ( HostID  host,
int  newValInMs 
)
pure virtual

Specify timeout threshold(msec.) for disconnection in case of disconnected from server too long. Difference from SetDefaultTimeoutTimeMS is that you can change timeout during runtime for specific host. -You can use it regardless of before or after starting the server. -Applied to specific host(client). -It may take some seconds to apply the time out value change.

virtual void Proud::CNetServer::Start ( CStartServerParameter param)
pure virtual

The server starts. If the server does not start, Proud.Exception will throw. Setting for the initiating the

Parameters
server.Able to indicate TCP listen port.
virtual void Proud::CNetServer::Start ( CStartServerParameter param,
ErrorInfoPtr outError 
)
pure virtual

The server starts. If the server does not start, error information goes in to outError. For detail information please refer to Proud.CNetServer.Start(CStartServerParameter&).

virtual void Proud::CNetServer::Stop ( )
pure virtual

Stop server.

  • Warning!! This function never call in function that call from UserWorkerThread such as rmi.