/// <summary> /// Initialize the ServerNetworkManager instance. /// </summary> /// <param name="WorldManager">Supplies the game world manager to which /// the network manager instance is bound.</param> /// <param name="LocalServerId">Supplies the server id of the local /// server.</param> /// <param name="Script">Supplies the main script object.</param> public ServerNetworkManager(GameWorldManager WorldManager, int LocalServerId, ACR_ServerCommunicator Script) { SocketIo.Initialize(Script); this.WorldManager = WorldManager; this.LocalServerId = LocalServerId; }
/// <summary> /// Send a direct message to a server. Failures are ignored. /// </summary> /// <param name="Data">Supplies the message payload.</param> /// <param name="Server">Supplies the destination server.</param> private void SendMessageToServer(byte[] Data, GameServer Server) { try { IPAddress Address; if (Server.ServerId == LocalServerId) { Address = IPAddress.Loopback; } else { Address = Server.GetIPAddress(); } SocketIo.SendMessage(Data, Address, Server.ServerPort); } catch { } }