Пример #1
0
        private void Server_ConnectionLost(object sender, DisconnectEventArgs e)
        {
            AddMessage(ServerStrings.ConnectionLost.With(SocketErrorTranslator.GetMessage(e.SocketErrorCode)));

            if (e.Reason != DisconnectReason.UserInitiated)
            {
                AddMessage(ServerStrings.AttemptingReconnect);
                ThreadHelper.InvokeAfter(TimeSpan.FromSeconds(4), delegate { server.Connect(); });
            }
        }
Пример #2
0
 private void Server_ConnectFailed(object sender, ConnectFailedEventArgs e)
 {
     AddMessage(ServerStrings.ConnectionFailedMessage.With(SocketErrorTranslator.GetMessage(e.SocketErrorCode)));
     ThreadHelper.InvokeAfter(TimeSpan.FromSeconds(4), delegate { server.Connect(); });
 }