/// <summary>
        /// Handles socket errors.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="x"></param>
        private void HandleSocketError(SocketCallBackResult result, Exception x)
        {
            // Log socket errors to log
            if (m_pSocket.Logger != null)
            {
                if (result == SocketCallBackResult.SocketClosed)
                {
                    m_pSocket.Logger.AddTextEntry("Server closed socket !");
                }
                else if (x != null && x is SocketException)
                {
                    SocketException socketException = (SocketException) x;
                    // Server disconnected or aborted connection
                    if (socketException.ErrorCode == 10054 || socketException.ErrorCode == 10053)
                    {
                        m_pSocket.Logger.AddTextEntry("Server closed socket or aborted connection !");
                    }
                }
                else
                {
                    m_pSocket.Logger.AddTextEntry("Unknown error !");
                }
            }

            if (result == SocketCallBackResult.Exception)
            {
                throw x;
            }
            else
            {
                throw new Exception(result.ToString());
            }
        }
		/// <summary>
		/// Handles socket errors.
		/// </summary>
		/// <param name="result"></param>
		/// <param name="x"></param>
		private void HandleSocketError(SocketCallBackResult result,Exception x)
		{
			if(result == SocketCallBackResult.Exception){
				throw x;
			}
			else{
				throw new Exception(result.ToString());
			}
		}