Utilization of Server
Handling Timer Loop, RMI, and Events
You don't have to call it every hour on the server, but if you want to do something every certain amount of time, you'll need to specify a timer callback function, a callback period, and custom data to pass to the callback function when you start the server.
Below is where to specify them
C++
Proud.INetServerEvent.OnTimerCallback
Proud.CStartServerParameter.m_timerCallbackInterval
Proud.CStartServerParameter.m_timerCallbackContext
C#
Nettention.Proud.NetServer.TickDelegate
Nettention.Proud.StartServerParameter.timerCallbackIntervalMs
-
Getting various information
Server allows you to get the client list, P2P group information, client IP information, ping time, and more.
Proud.CNetServer.GetClientCount
Nettention.Proud.NativeNetServer.GetClientCount
Gets the number of connected clients.
Proud.CNetServer.GetClientHostIDs
Nettention.Proud.NetServer.GetClientHostIDs
Get a list of HostIDs of connected clients.
Proud.CNetServer.GetClientInfo
Nettention.Proud.NetServer.GetClientInfo
Gets information about the client with the HostID given as a parameter.
Proud.CNetServer.GetJoinedP2PGroups
-
Gets all the p2p groups that the client with the HostID given as a parameter belongs to.
Proud.CNetServer.GetLastUnreliablePingMs
Nettention.Proud.NetServer.GetLastUnreliablePingMs
Returns the most recently taken ping time in milliseconds.
Proud.CNetServer.GetP2PGroupInfo
Nettention.Proud.NetServer.GetP2PGroupInfo
Gets the information for the P2P group given by the parameters.
Proud.CNetServer.GetP2PGroups
-
Get all P2P groups.
Proud.CNetServer.GetRecentUnreliablePingMs
Nettention.Proud.NetServer.GetRecentUnreliablePingMs
Returns the most recently taken ping time in milliseconds.
Proud.CNetServer.GetRemoteIdentifiableLocalAddrs
-
Get the server's listening port address that the client can recognise.
Proud.CNetServer.GetStats
Nettention.Proud.NetServer.GetStats
Gets server status information.
Proud.CNetServer.GetTcpListenerLocalAddr
Nettention.Proud.NetServer.GetTcpListenerLocalAddr
Gets all local addresses with which TCP communication is possible.
Proud.CNetServer.GetTimeMs
Nettention.Proud.NetServer.GetTimeMs
Get the current server time in ms.
Proud.CNetServer.GetUdpListenerLocalAddrs
-
Gets all local addresses that are Udp communicable.
Proud.CNetServer.IsConnectedClient
Nettention.Proud.NativeNetServer.IsConnectedClient
Returns whether the client with the HostID given as a parameter is connected.
Communicating between servers
If the servers work in a role-sharing manner, they need to establish a connection to each other for communication between each server. At this point, P2P groups can be used to facilitate server-to-server communication.
Set one Farm server. A LAN group where server computers exist is called a server farm.
All other servers have P2P communication between Farm Clients that connect to the farm server.
Each farm client, or server process, can communicate directly with each other regardless of whether it is a server or a client. Random forms of mesh communication are possible and free dependencies between them can be established.
The use of net_main is recommended for server-to-server communication, and the message_length of the communication should also be considered.
Reference
⬅️ Back
Last updated