コード例 #1
0
 /// <summary>
 /// Handler for Socket Error Event.
 /// </summary>
 /// <param name="iSource"></param>
 /// <param name="iArgs"></param>
 static void OnSocketError(object iSource, SocketErrorEventArgs iArgs)
 {
     GMutex.WaitOne();
     Console.WriteLine();
     Console.WriteLine(DateTime.Now.TimeOfDay + ": WARN: Socket Status: {0}, Error: {1}", iArgs.Status, iArgs.Error);
     GMutex.ReleaseMutex();
 }
コード例 #2
0
ファイル: RPBot.cs プロジェクト: jcryer/RPBot
        private async Task Discord_SocketError(SocketErrorEventArgs e)
        {
            try
            {
                await(await e.Client.GetChannelAsync(392429153909080065)).SendMessageAsync("Not Restarting(test): Socket Error");
            }
            catch
            {
            }
            RPClass.SaveData(-1);

            /*
             * var process = new Process()
             * {
             *  StartInfo = new ProcessStartInfo
             *  {
             *      FileName = "/bin/bash",
             *      Arguments = $"-c \"dotnet RPBot-Core.dll\"",
             *      RedirectStandardOutput = true,
             *      UseShellExecute = false,
             *      CreateNoWindow = true,
             *  }
             * };
             * process.Start();
             * Environment.Exit(-1);
             * await Task.Delay(0);
             */
        }
コード例 #3
0
ファイル: TestBot.cs プロジェクト: DSharpPlus/DSharpPlus
        //private Task Discord_ClientErrored(DiscordClient client, ClientErrorEventArgs e)
        //{
        //    e.Client.Logger.LogError(TestBotEventId, e.Exception, "Client threw an exception");
        //    return Task.CompletedTask;
        //}

        private Task Discord_SocketError(DiscordClient client, SocketErrorEventArgs e)
        {
            var ex = e.Exception is AggregateException ae ? ae.InnerException : e.Exception;

            client.Logger.LogError(TestBotEventId, ex, "WebSocket threw an exception");
            return(Task.CompletedTask);
        }
コード例 #4
0
 /// <summary>
 ///   Callback for disconnects.
 /// </summary>
 /// <param name = "sender">
 ///   The sender.
 /// </param>
 /// <param name = "e">
 ///   The event args.
 /// </param>
 private void TcpClient_OnDisconnected(object sender, SocketErrorEventArgs e)
 {
     if (Interlocked.Increment(ref this.disconnect) == ClientCount)
     {
         this.autoReset.Set();
     }
 }
コード例 #5
0
        private async Task Discord_SocketError(SocketErrorEventArgs e)
        {
            try
            {
                await RPClass.LogChannel.SendMessageAsync("Restarting: Socket Error");
            }
            catch
            {
            }
            RPClass.SaveData(-1);
            var process = new Process()
            {
                StartInfo = new ProcessStartInfo
                {
                    FileName  = "/bin/bash",
                    Arguments = $"-c \"dotnet RPBot-Core.dll\"",
                    RedirectStandardOutput = true,
                    UseShellExecute        = false,
                    CreateNoWindow         = true,
                }
            };

            process.Start();
            Environment.Exit(-1);
            await Task.Delay(0);
        }
コード例 #6
0
        private Task Discord_SocketError(SocketErrorEventArgs e)
        {
            var ex = e.Exception is AggregateException ae ? ae.InnerException : e.Exception;

            this.Discord.DebugLogger.LogMessage(LogLevel.Error, "DSP Test", $"WS threw an exception: {ex.GetType()}", DateTime.Now, ex);
            return(Task.CompletedTask);
        }
コード例 #7
0
 private static Task onSerr(SocketErrorEventArgs e)
 {
     Console.WriteLine("!-------------------------------!");
     Console.WriteLine(" Exception: SoketError" /*+ e.Exception*/);
     Console.WriteLine("!-------------------------------!");
     return(Task.CompletedTask);
 }
コード例 #8
0
ファイル: GatewaySession.cs プロジェクト: yiki2/GF.Gateway
 void _onSocketError(object rec, SocketErrorEventArgs args)
 {
     if (OnSocketError != null)
     {
         OnSocketError(this, args);
     }
 }
コード例 #9
0
        private void OnGameClientConnectError(object sender, SocketErrorEventArgs e)
        {
            log.WarnFormat("TestClient({1}): Failed to connect to game server: error = {0}", e.SocketError, userId);

            //TODO connection failed state? or set an error?
            this.connectionState = TestClientConnectionState.Disconnected;
        }
コード例 #10
0
 private async Task OnSocketErrored(SocketErrorEventArgs e)
 {
     if (SocketErrored != null)
     {
         await SocketErrored(e);
     }
 }
コード例 #11
0
        private async Task SocketErrored(SocketErrorEventArgs e)
        {
            Console.WriteLine("[Reconnect] Websocket Errored. Attempting to reconnect.");
            await e.Client.DisconnectAsync();

            await e.Client.ConnectAsync();
        }
コード例 #12
0
 protected internal virtual void OnNetworkError(SocketErrorEventArgs e)
 {
     if (NetworkError != null)
     {
         NetworkError(this, e);
     }
 }
コード例 #13
0
ファイル: NetBridge.cs プロジェクト: LazyPlanet/CasinosClient
        //---------------------------------------------------------------------
        void _onSocketError(object rec, SocketErrorEventArgs args)
        {
            BuglyAgent.PrintLog(LogSeverity.Log, args.Exception.Message);
            BuglyAgent.ReportException(args.Exception, args.Exception.Message);

            _onSocketClose();
        }
コード例 #14
0
 private Task SocketError(SocketErrorEventArgs e)
 {
     Console.WriteLine("Socket Error!");
     Console.WriteLine(e.ToString());
     Close();
     OnClosed?.Invoke();
     return(Task.CompletedTask);
 }
コード例 #15
0
 public Task SocketError(SocketErrorEventArgs e)
 {
     e.Client.DebugLogger.LogMessage(LogLevel.Error,
                                     "nullopt",
                                     $"Exception occured: {e.Exception.GetType()}: {e.Exception.Message}",
                                     DateTime.Now);
     return(Task.CompletedTask);
 }
コード例 #16
0
        /// <summary>
        /// Executed when IRC client connect failed.
        /// Beware: This is executed by a different thread.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OnIrcClientConnectFailed(object sender, SocketErrorEventArgs e)
        {
            // close connection and exit
            ServerConnection.Disconnect();
            IsRunning  = false;
            IrcChannel = null;

            Log("ERROR", LOG_IRCCONNECTERROR);
        }
コード例 #17
0
 private void QueryDispatcher_SocketError(object sender, SocketErrorEventArgs e)
 {
     if (!Connected)
     {
         return;
     }
     Console.WriteLine($"Something went wrong: {e.SocketError}");
     Disconnect();
 }
コード例 #18
0
    //-------------------------------------------------------------------------
    void _onSocketError(object rec, SocketErrorEventArgs args)
    {
        //this.tcpSocket = null;

        if (OnSocketError != null)
        {
            OnSocketError.Invoke(this, args);
        }
    }
コード例 #19
0
ファイル: RpcSessionTcpClient.cs プロジェクト: yinlei/Fishing
    //---------------------------------------------------------------------
    void _onSocketError(object rec, SocketErrorEventArgs args)
    {
        this.tcpSocket = null;

        if (OnSocketError != null)
        {
            OnSocketError(this, args);
        }
    }
コード例 #20
0
        //---------------------------------------------------------------------
        void _onSocketError(object rec, SocketErrorEventArgs args)
        {
            //if (args != null && args.Exception != null)
            //{
            //    BuglyAgent.PrintLog(LogSeverity.Log, args.Exception.Message);
            //    BuglyAgent.ReportException(args.Exception, args.Exception.Message);
            //}

            _onSocketClose();
        }
コード例 #21
0
        private void TMNRPCClient_SocketError(object sender, SocketErrorEventArgs e)
        {
            SocketAsyncEventArgs.Dispose();
            SocketAsyncEventArgs = null;

            if (e.SocketError == System.Net.Sockets.SocketError.ConnectionReset && ServerClosedConnection != null)
            {
                ServerClosedConnection(this, EventArgs.Empty);
            }
        }
コード例 #22
0
        //-------------------------------------------------------------------------
        void _onSocketError(object rec, SocketErrorEventArgs args)
        {
            EbLog.Note("ClientNetMonitor._onSocketError()");

            //FloatMsgInfo f_info;
            //f_info.msg = "连接已断开!";
            //f_info.color = Color.red;
            //UiMgr.Instance.FloatMsgMgr.createFloatMsg(f_info);

            _onSocketClose();
        }
コード例 #23
0
        private Task Discord_SocketErrored(DiscordClient sender, SocketErrorEventArgs e)
        {
            var ex = e.Exception;

            while (ex is AggregateException)
            {
                ex = ex.InnerException;
            }

            sender.Logger.LogCritical(LogEvent, $"Socket threw an exception {ex.GetType()}: {ex.Message}", DateTime.Now);
            return(Task.CompletedTask);
        }
コード例 #24
0
        private Task Discord_SocketErrored(SocketErrorEventArgs e)
        {
            var ex = e.Exception;

            while (ex is AggregateException)
            {
                ex = ex.InnerException;
            }

            e.Client.DebugLogger.LogMessage(LogLevel.Critical, LOG_TAG, $"Socket threw an exception {ex.GetType()}: {ex.Message}", DateTime.Now);
            return(Task.CompletedTask);
        }
コード例 #25
0
        private void OnGameClientDisconnected(object sender, SocketErrorEventArgs e)
        {
            if (log.IsDebugEnabled)
            {
                log.DebugFormat("TestClient({0}): disconnected from game server.", userId);
            }

            if (this.connectionState != TestClientConnectionState.Stopped)
            {
                this.connectionState = TestClientConnectionState.Disconnected;
            }
        }
コード例 #26
0
        private void OnSocketError(object sender, SocketErrorEventArgs e)
        {
            Log.Error("MJpeg server error " + e.Message);
            // ISSUE: reference to a compiler-generated field
            EventHandler <StreamErrorEventArgs> streamError = this.StreamError;

            if (streamError == null)
            {
                return;
            }
            streamError((object)this, new StreamErrorEventArgs(string.Format("Socket error: {0}", (object)e.Message), e));
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: circlesabound/BlendoBot
        private async Task DiscordSocketErrored(SocketErrorEventArgs e)
        {
            Log(this, new LogEventArgs {
                Type    = LogType.Error,
                Message = $"SocketErrored triggered: {e.Exception}"
            });

            //HACK: This should try and reconnect should something wrong happen.
            await DiscordClient.ConnectAsync();

            await Task.Delay(0);
        }
コード例 #28
0
    //---------------------------------------------------------------------
    void _onError(object client, SocketErrorEventArgs args)
    {
        lock (LockWorker)
        {
            SocketEvent socket_event;
            socket_event.type   = eSocketEventType.Error;
            socket_event.client = client;
            socket_event.args   = args;

            mSocketEvent.Enqueue(socket_event);
        }
    }
コード例 #29
0
        /// <summary>
        /// This event is raised when a socket exception has occured
        /// ConnectionRefused:
        /// Teamspeak is not running
        /// Increment reconnect timer time Interval with 1 second until 15 seconds
        /// Disconnect
        /// other:
        /// Disconnect
        /// </summary>
        private void QueryDispatcher_SocketError(object sender, SocketErrorEventArgs e)
        {
            // do not handle connection lost errors because they are already handled by QueryDispatcher_ServerClosedConnection
            if (e.SocketError == SocketError.ConnectionReset)
            {
                return;
            }

            //if (e.SocketError == SocketError.ConnectionRefused)


            Disconnect();
        }
コード例 #30
0
 void socketServer_OnSocketError(object sender, SocketErrorEventArgs e)
 {
     if (sender is AsyncSocketConnection)
     {
         var conn = sender as AsyncSocketConnection;
         log.ErrorFormat("通信错误:  tid:{0}, {1}, {2}", conn.TerminalId, e.Error.Message, e.Error.StackTrace);
     }
     else
     {
         SocketError se = (SocketError)e.ErrorCode;
         log.ErrorFormat("通信错误", se.GetDescription() + "," + e.Error.Message);
     }
 }
コード例 #31
0
        private void QueryDispatcher_SocketError(object sender, SocketErrorEventArgs e)
        {
            // do not handle connection lost errors because they are already handled by QueryDispatcher_ServerClosedConnection
            if (e.SocketError == SocketError.ConnectionReset)
            {
                return;
            }

            // this event is raised when a socket exception has occured
            MessageBox.Show("Socket error!! Error Code: " + e.SocketError);

            // force disconnect
            Disconnect();
        }
コード例 #32
0
 private void OnGameClientConnectError(object sender, SocketErrorEventArgs e)
 {
     log.WarnFormat("GAME: Failed to connect to game server: error = {0}", e);
 }
コード例 #33
0
ファイル: Master.cs プロジェクト: azanium/PopBloop-GameServer
        private void OnMasterClientConnectError(object sender, SocketErrorEventArgs e)
        {
            log.WarnFormat("MASTER: Connect to master failed: err={0}", e.SocketError);

            this.resetEvent.Set();
        }
コード例 #34
0
 /// <summary>
 ///   Logs an error.
 /// </summary>
 /// <param name = "sender">
 ///   The sender.
 /// </param>
 /// <param name = "e">
 ///   The event args.
 /// </param>
 private static void TcpClient_OnConnectError(object sender, SocketErrorEventArgs e)
 {
     log.Error(e.SocketError);
 }
コード例 #35
0
 /// <summary>
 ///   Callback for disconnects.
 /// </summary>
 /// <param name = "sender">
 ///   The sender.
 /// </param>
 /// <param name = "e">
 ///   The event args.
 /// </param>
 private void TcpClient_OnDisconnected(object sender, SocketErrorEventArgs e)
 {
     if (Interlocked.Increment(ref this.disconnect) == ClientCount)
     {
         this.autoReset.Set();
     }
 }