コード例 #1
0
 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
         {
         }
     }
 }
コード例 #2
0
 private void Server_OnConnectionLobbyAcceptedEvent(EndPointId endPointId, long ping)
 {
     OnConnectionLobbyAcceptedEvent?.Invoke(endPointId, ping);
 }