public override void OnEnter() { UdpEndPoint endpoint = new UdpEndPoint(UdpIPv4Address.Parse(host.Value), (ushort)port.Value); BoltLauncher.StartServer(endpoint); Finish(); }
public override void OnEnter() { UdpEndPoint endpoint = new UdpEndPoint(UdpIPv4Address.Parse(host.Value), (ushort)port.Value); BoltNetwork.Connect(endpoint); Finish(); }
private void Start() { AdvancedTutorial.ServerCallbacks.ListenServer = false; // Start listening on IP + Port provided by zeuz, and load the Map received as command line argument (can be different for each profile defined in zeuz dashboard) BoltLauncher.StartServer(new UdpEndPoint(UdpIPv4Address.Parse(Zeuz.IP), (ushort)Zeuz.GamePort), m_Map); DontDestroyOnLoad(this); }
//========== PUBLIC METHODS ==================================================================================== public override void BoltStartDone() { m_GameState = EGameState.Playing; #if BOLT_CLOUD BoltLog.Error("Can't connect to {0}:{1}. Direct connection is not available in free version!", m_IPAddress, m_Port); #else BoltNetwork.Connect(new UdpEndPoint(UdpIPv4Address.Parse(m_IPAddress), (ushort)m_Port)); #endif }
public override void BoltStartDone() { if (BoltNetwork.isClient) { BoltNetwork.Connect(new UdpEndPoint(UdpIPv4Address.Parse(serverAddress), (ushort)serverPort)); } else { BoltNetwork.LoadScene(map); } }
private bool CheckNetworkConfiguration() { bool result = true; if (!this.isMachineNetAvailable) { Debug.LogError("Your host network seens to be disconnected"); result = false; } UdpIPv4Address udpIPv4Address = UdpIPv4Address.Any; bool flag = true; try { udpIPv4Address = UdpIPv4Address.Parse(SteamDSConfig.ServerAddress); } catch { Debug.LogError("You configure a invalid ip address: " + SteamDSConfig.ServerAddress); flag = false; result = false; } if (flag) { string machineIp = this.getMachineIp(); bool flag2 = true; if (machineIp != string.Empty) { if (machineIp.ToLower().Trim() != SteamDSConfig.ServerAddress.ToLower().Trim()) { Debug.LogError("You configure ip address as " + SteamDSConfig.ServerAddress + " but your host IP seens to be " + machineIp); result = false; } } else { Debug.LogError("Unable to check you host IP address"); result = false; flag2 = false; } if (flag2 && !this.CheckPorts(IPAddress.Parse(machineIp), new int[] { (int)SteamDSConfig.ServerGamePort, (int)SteamDSConfig.ServerQueryPort, (int)SteamDSConfig.ServerSteamPort })) { result = false; } } return(result); }
public override void BoltStartDone() { if (BoltNetwork.IsClient) { #if !BOLT_CLOUD UdpEndPoint endPoint = new UdpEndPoint(UdpIPv4Address.Parse(serverAddress), (ushort)serverPort); BoltNetwork.Connect(endPoint); #endif } else { BoltNetwork.LoadScene(map); } }
public override void BoltStartDone() { if (BoltNetwork.IsClient) { if (staticData.boltFree == false) { #if !BOLT_CLOUD TestToken token = new TestToken(); token.ArbitraryData = myPlayerSessionID; UdpEndPoint endPoint = new UdpEndPoint(UdpIPv4Address.Parse(selectedGameSession.IpAddress), (ushort)selectedGameSession.Port); BoltNetwork.Connect(endPoint, token); #endif } } }
public override void BoltStartDone() { if (BoltNetwork.isClient) { UdpEndPoint endPoint = new UdpEndPoint(UdpIPv4Address.Parse(serverAddress), (ushort)serverPort); RoomProtocolToken token = new RoomProtocolToken(); token.ArbitraryData = "Room Token"; BoltNetwork.Connect(endPoint, token); } else { BoltNetwork.LoadScene(map); } }
public void LaunchDSServer() { if (SteamDSConfig.useLaunchDisplay) { this.setServerData(); } UdpIPv4Address udpIPv4Address = UdpIPv4Address.Any; try { udpIPv4Address = UdpIPv4Address.Parse(SteamDSConfig.ServerAddress); } catch { udpIPv4Address = UdpIPv4Address.Any; } SteamDSConfig.EndPoint = new UdpEndPoint(udpIPv4Address, SteamDSConfig.ServerGamePort); GameSetup.SetPlayerMode(PlayerModes.Multiplayer); GameSetup.SetMpType(MpTypes.Server); GameSetup.SetGameType(GameTypes.Standard); GameSetup.SetDifficulty(this.StringToEnum <DifficultyModes>(SteamDSConfig.GameDifficulty)); GameSetup.SetInitType(this.StringToEnum <InitTypes>(SteamDSConfig.GameType)); GameSetup.SetSlot((Slots)SteamDSConfig.GameSaveSlot); SteamDSConfig.ServerAuthMode = ((!SteamDSConfig.ServerVACEnabled) ? EServerMode.eServerModeAuthentication : EServerMode.eServerModeAuthenticationAndSecure); Debug.LogFormat("Dedicated server info:\n IP:{0}, steamPort:{1}, gamePort:{2}, queryPort:{3}\n players:{4}, admin password:'******', password:'******', autosave interval:{7}", new object[] { udpIPv4Address, SteamDSConfig.ServerSteamPort, SteamDSConfig.ServerGamePort, SteamDSConfig.ServerQueryPort, SteamDSConfig.ServerPlayers, (!string.IsNullOrEmpty(SteamDSConfig.ServerAdminPassword)) ? "yes" : "no", (!string.IsNullOrEmpty(SteamDSConfig.ServerPassword)) ? "yes" : "no", SteamDSConfig.GameAutoSaveIntervalMinutes }); Debug.LogFormat("Game setup: {0} {1} {2}, {3} {4} game, slot {5}", new object[] { GameSetup.Game, GameSetup.Mode, GameSetup.MpType, GameSetup.Init, GameSetup.Difficulty, GameSetup.Slot }); PlayerPreferences.ApplyMaxFrameRate(); Application.LoadLevel("SteamStartSceneDedicatedServer"); }
public void ConnectServer(CClientNetworkCtrl clientNetworkCtrl) { //sever and client. localPort = clientNetworkCtrl.LocalPort; UdpEndPoint serverPoint = new UdpEndPoint(UdpIPv4Address.Any, (ushort)localPort); server.Start(serverPoint); IPAddress ipaddr = IPAddress.Parse(clientNetworkCtrl.ServerIP); hostUser.ProxyServer = new IPEndPoint(ipaddr, clientNetworkCtrl.ServerPort); UdpIPv4Address address = UdpIPv4Address.Parse(clientNetworkCtrl.ServerIP); UdpEndPoint endp = new UdpEndPoint(address, (ushort)clientNetworkCtrl.ServerPort); server.Connect(endp); Log.info("UdpClientNetWork", "UdpClientNetWork Start, UdpPort:" + localPort + " ServerIP:" + clientNetworkCtrl.ServerIP.ToString() + " ProxyServer address:" + endp.ToString()); CtrlOwner = clientNetworkCtrl; }
DotNetInterface ParseInterface(NetworkInterface n) { HashSet<UdpIPv4Address> gateway = new HashSet<UdpIPv4Address>(UdpIPv4Address.Comparer.Instance); HashSet<UdpIPv4Address> unicast = new HashSet<UdpIPv4Address>(UdpIPv4Address.Comparer.Instance); HashSet<UdpIPv4Address> multicast = new HashSet<UdpIPv4Address>(UdpIPv4Address.Comparer.Instance); IPInterfaceProperties p = null; try { p = n.GetIPProperties(); } catch { return null; } if (p != null) { try { foreach (var gw in p.GatewayAddresses) { try { if (gw.Address.AddressFamily == AddressFamily.InterNetwork) { gateway.Add(ConvertAddress(gw.Address)); } } catch { } } } catch { } try { foreach (var addr in p.DnsAddresses) { try { if (addr.AddressFamily == AddressFamily.InterNetwork) { gateway.Add(ConvertAddress(addr)); } } catch { } } } catch { } try { foreach (var uni in p.UnicastAddresses) { try { if (uni.Address.AddressFamily == AddressFamily.InterNetwork) { UdpIPv4Address ipv4 = ConvertAddress(uni.Address); unicast.Add(ipv4); gateway.Add(new UdpIPv4Address(ipv4.Byte3, ipv4.Byte2, ipv4.Byte1, 1)); } } catch { } } } catch { } try { foreach (var multi in p.MulticastAddresses) { try { if (multi.Address.AddressFamily == AddressFamily.InterNetwork) { multicast.Add(ConvertAddress(multi.Address)); } } catch { } } } catch { } if (unicast.Count == 0 || gateway.Count == 0) { return null; } } return new DotNetInterface(n, gateway.ToArray(), unicast.ToArray(), multicast.ToArray()); }
private void State_StartClient() { BoltLauncher.StartClient(UdpEndPoint.Any); BoltNetwork.Connect(new UdpEndPoint(UdpIPv4Address.Parse(this.serverAddress), (ushort)this.serverPort)); this.state = BoltInit.State.Started; }
private DotNetInterface ParseInterface(NetworkInterface n) { HashSet <UdpIPv4Address> hashSet = new HashSet <UdpIPv4Address>(UdpIPv4Address.Comparer.Instance); HashSet <UdpIPv4Address> hashSet2 = new HashSet <UdpIPv4Address>(UdpIPv4Address.Comparer.Instance); HashSet <UdpIPv4Address> hashSet3 = new HashSet <UdpIPv4Address>(UdpIPv4Address.Comparer.Instance); IPInterfaceProperties iPInterfaceProperties = null; try { iPInterfaceProperties = n.GetIPProperties(); } catch { return(null); } if (iPInterfaceProperties != null) { try { foreach (GatewayIPAddressInformation current in iPInterfaceProperties.GatewayAddresses) { try { if (current.Address.AddressFamily == AddressFamily.InterNetwork) { hashSet.Add(DotNetPlatform.ConvertAddress(current.Address)); } } catch { } } } catch { } try { foreach (IPAddress current2 in iPInterfaceProperties.DnsAddresses) { try { if (current2.AddressFamily == AddressFamily.InterNetwork) { hashSet.Add(DotNetPlatform.ConvertAddress(current2)); } } catch { } } } catch { } try { foreach (UnicastIPAddressInformation current3 in iPInterfaceProperties.UnicastAddresses) { try { if (current3.Address.AddressFamily == AddressFamily.InterNetwork) { UdpIPv4Address item = DotNetPlatform.ConvertAddress(current3.Address); hashSet2.Add(item); hashSet.Add(new UdpIPv4Address(item.Byte3, item.Byte2, item.Byte1, 1)); } } catch { } } } catch { } try { foreach (MulticastIPAddressInformation current4 in iPInterfaceProperties.MulticastAddresses) { try { if (current4.Address.AddressFamily == AddressFamily.InterNetwork) { hashSet3.Add(DotNetPlatform.ConvertAddress(current4.Address)); } } catch { } } } catch { } if (hashSet2.Count == 0 || hashSet.Count == 0) { return(null); } } return(new DotNetInterface(n, hashSet.ToArray <UdpIPv4Address>(), hashSet2.ToArray <UdpIPv4Address>(), hashSet3.ToArray <UdpIPv4Address>())); }
void State_StartClient() { BoltLauncher.StartClient(UdpEndPoint.Any); BoltNetwork.Connect(new UdpEndPoint(UdpIPv4Address.Parse(serverAddress), (ushort)serverPort)); state = State.Started; }
public override bool ConnectSync(IPEndPoint localAddress, IPEndPoint remoteAddress, int timeout) { long num = DateTime.Now.ToFileTime() / 10000L; bool result; if (IsConnected()) { UdpIPv4Address udpIPv4Address = new UdpIPv4Address(NetUtil.GetLongAddress(remoteAddress.Address.GetAddressBytes())); UdpIPv4Address address = this.udpRemote.Address; if (address.Equals(udpIPv4Address) && (int)udpRemote.Port == remoteAddress.Port) { result = true; return(result); } LoggerManager.Instance.Warn("ConnectSync found already connected new addr {0} old addr {1}", remoteAddress.ToString(), udpRemote.ToString()); } if (!IsConnecting()) { udpRemote = new UdpEndPoint(new UdpIPv4Address(NetUtil.GetLongAddress(remoteAddress.Address.GetAddressBytes())), (ushort)remoteAddress.Port); remote = remoteAddress; socket.Connect(udpRemote); } object obj = statusLock; Monitor.Enter(obj); try { connectionStatus = ConnectionStatus.Connecting; } finally { Monitor.Exit(obj); } long num2 = DateTime.Now.ToFileTime() / 10000L; while (num2 - num < (long)(timeout * 1000)) { UdpEvent ev; if (socket.Poll(out ev)) { UdpEventType eventType = ev.EventType; switch (eventType) { case UdpEventType.ConnectFailed: case UdpEventType.ConnectRefused: case UdpEventType.Connected: ProcessConnect(ev); result = (ev.EventType == UdpEventType.Connected); return(result); case (UdpEventType)5: case (UdpEventType)7: break; default: if (eventType == UdpEventType.ServerForceQuit) { ProcessServerForceQuit(ev); result = false; return(result); } break; } } Thread.Sleep(10); num2 = DateTime.Now.ToFileTime() / 10000L; } Monitor.Enter(obj = this.statusLock); try { connectionStatus = ConnectionStatus.Disconnected; } finally { Monitor.Exit(obj); } result = false; return(result); }