private void StartServer() { lanBc.StopBroadcasting(); lanBc.StartAnnounceBroadcasting(); udpHandler = new UdpHandler(portGameServer); udpHandler.StartListening(); role = PlayerRole.Server; Debug.Log("Starting Server -> " + udpHandler.SessionId); }
private void ConnectToServer(string ip) { Debug.Log("Connecting to server: " + ip); lanBc.StopBroadcasting(); udpHandler = new UdpHandler(portGameClient); udpHandler.StartListening(); destAddr = new IPEndPoint(IPAddress.Parse(ip), portGameServer); var command = new CommandConnect(); udpHandler.SendMessage(new UdpMessage(destAddr, command)); role = PlayerRole.Client; }