Example #1
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();
        }
Example #2
0
        /// <summary>
        /// Handler for the SocketError event
        /// </summary>
        private void QueryDispatcher_SocketError(object sender, SocketErrorEventArgs e)
        {
            logger.Warn("SocketError: {0}", e.SocketError);

            // Do not handle connection lost errors because they are already handled by QueryDispatcher_ServerClosedConnection
            if (e.SocketError == SocketError.ConnectionReset)
            {
                return;
            }
            else if (e.SocketError == SocketError.AccessDenied
                    || e.SocketError == SocketError.AddressAlreadyInUse
                    || e.SocketError == SocketError.ConnectionRefused)
            {
                logger.Warn("Connection refused");
                this.RaiseConnectionRefused();
            }

            // Force disconnect
            this.Disconnect();
        }
        private void AdvancedTcpDispatcher_SocketError(object sender, SocketErrorEventArgs e)
        {
            _greetingReceived = false;

            if (SocketAsyncEventArgs != null)
            {
                SocketAsyncEventArgs.Dispose();
                SocketAsyncEventArgs = null;
            }

            if (e.SocketError == System.Net.Sockets.SocketError.ConnectionReset && ServerClosedConnection != null)
                ThreadPool.QueueUserWorkItem(OnServerClosedConnection);
        }
Example #4
0
 private void QueryDispatcher_SocketError(object sender, SocketErrorEventArgs e)
 {
     if (e.SocketError == SocketError.ConnectionReset)
         return;
     Console.WriteLine("Socket error!! Error Code: " + e.SocketError);
     DisconnectFromClient();
     state = State.Disconnected;
     Reconnect();
 }
Example #5
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();
        }