public override SocketTasks StartClient() { var socketTask = SocketTask.Working; m_ServerHostId = RelayTransport.AddHost(new HostTopology(GetConfig(), 1), false); m_ServerConnectionId = RelayTransport.Connect(m_ServerHostId, ConnectAddress, ConnectPort, 0, out byte error); var connectError = (NetworkError)error; switch (connectError) { case NetworkError.Ok: socketTask.Success = true; socketTask.TransportCode = error; socketTask.SocketError = System.Net.Sockets.SocketError.Success; socketTask.IsDone = false; // We want to continue to wait for the successful connect m_ConnectTask = socketTask; break; default: socketTask.Success = false; socketTask.TransportCode = error; socketTask.SocketError = System.Net.Sockets.SocketError.SocketError; socketTask.IsDone = true; break; } return(socketTask.AsTasks()); }
public int Connect(string address, int port, object settings, bool websocket, out byte error) { NetworkTransport.Init(); int hostId = RelayTransport.AddHost((HostTopology)settings, false); return(RelayTransport.Connect(hostId, address, port, 0, out error)); }
public override void StartClient() { UpdateRelay(); serverHostId = RelayTransport.AddHost(new HostTopology(GetConfig(), 1), false); serverConnectionId = RelayTransport.Connect(serverHostId, ConnectAddress, ConnectPort, 0, out byte error); }
public void RegisterServerListenSocket(object settings) { HostTopology topology = new HostTopology((ConnectionConfig)settings, NetworkingManager.singleton.NetworkConfig.MaxConnections); for (int i = 0; i < ServerTransports.Count; i++) { if (ServerTransports[i].Websockets) { RelayTransport.AddWebsocketHost(topology, ServerTransports[i].Port, true); } else { RelayTransport.AddHost(topology, ServerTransports[i].Port, true); } } }
public override void StartServer() { HostTopology topology = new HostTopology(GetConfig(), MaxConnections); if (SupportWebsocket) { if (!UseMLAPIRelay) { int websocketHostId = NetworkTransport.AddWebsocketHost(topology, ServerWebsocketListenPort); } else { if (LogHelper.CurrentLogLevel <= LogLevel.Error) { LogHelper.LogError("Cannot create websocket host when using MLAPI relay"); } } } int normalHostId = RelayTransport.AddHost(topology, ServerListenPort, true); }
public override SocketTasks StartServer() { var topology = new HostTopology(GetConfig(), MaxConnections); if (SupportWebsocket) { if (!UseMLAPIRelay) { int websocketHostId = UnityEngine.Networking.NetworkTransport.AddWebsocketHost(topology, ServerWebsocketListenPort); } else { if (NetworkLog.CurrentLogLevel <= LogLevel.Error) { NetworkLog.LogError("Cannot create websocket host when using MLAPI relay"); } } } int normalHostId = RelayTransport.AddHost(topology, ServerListenPort, true); return(SocketTask.Done.AsTasks()); }
public void Connect(string address, int port, object settings, out byte error) { serverHostId = RelayTransport.AddHost(new HostTopology((ConnectionConfig)settings, 1), false); serverConnectionId = RelayTransport.Connect(serverHostId, address, port, 0, out error); }