private void AcceptLobbyConnection() { while (true) { TcpClient client; long ping; try { client = tcpLobbyListener.AcceptTcpClient(); EndPointId identityId = EndPointId.FromSocket(((IPEndPoint)client.Client.RemoteEndPoint).Address.ToString(), ((IPEndPoint)client.Client.RemoteEndPoint).Port); lobbyClients.Add(identityId, client); Ping p = new Ping(); PingReply pInfo = p.Send(((IPEndPoint)client.Client.RemoteEndPoint).Address); ping = pInfo.RoundtripTime; OnConnectionLobbyAcceptedEvent?.Invoke(identityId, ping); } catch { } } }
private void Server_OnConnectionLobbyAcceptedEvent(EndPointId endPointId, long ping) { OnConnectionLobbyAcceptedEvent?.Invoke(endPointId, ping); }