示例#1
0
bool basic_io_device::would_block(system::error_code const &e)
{
	int code = e.value();
	bool block = 0
	#ifdef EAGAIN
	|| code==EAGAIN
	#endif
	#ifdef EINPROGRESS
	|| code == EINPROGRESS
	#endif
	#ifdef EWOULDBLOCK
	|| code == EWOULDBLOCK
	#endif
	#ifdef WSAEAGAIN
	|| code==WSAEAGAIN
	#endif
	#ifdef WSAEINPROGRESS
	|| code == WSAEINPROGRESS
	#endif
	#ifdef WSAEWOULDBLOCK
	|| code == WSAEWOULDBLOCK
	#endif
	;
	return block;
}
示例#2
0
void TcpServer::handle_acceptSSL(const system::error_code& error)
{
	if(!acceptor_.is_open())
	{
		debug->warning(1, type, "TCP Socket, port %i - acceptor is not open!", port);
		return;
	}

	if(!error)
		new_ssl_connection->start();
	else
		debug->warning(1, type, "TCP Socket, port %i - error: %s, error code: %i", error.message().c_str(), error.value());
	start_accept();
}
void TcpClient::PrintError(const system::error_code& ec)
{
	int error_code = ec.value();
	switch(error_code)
	{
	case error::access_denied: 
		std::cout<<"error::access_denied"<<std::endl;
		break;

	case error::address_family_not_supported: 
		std::cout<<"error::address_family_not_supported"<<std::endl;
		break;

	case error::address_in_use: 
		std::cout<<"error::address_in_use"<<std::endl;
		break;

	case error::already_connected:
		std::cout<<"error::already_connected "<<std::endl;
		break;

	case error::already_started:  
		std::cout<<"error::already_started "<<std::endl;
		break;

	case error::broken_pipe:  
		std::cout<<"error::broken_pipe "<<std::endl;
		break;

	case error::connection_aborted:   
		std::cout<<"error::connection_aborted  "<<std::endl;
		break;


	case error::connection_refused:   
		std::cout<<"error::connection_refused  "<<std::endl;
		break;

	case error::connection_reset:   
		std::cout<<"error::connection_reset  "<<std::endl;
		break;


	case error::bad_descriptor:  
		std::cout<<"error::bad_descriptor  "<<std::endl;
		break;



	case error::fault:   
		std::cout<<"error::fault  "<<std::endl;
		break;

	case error::host_unreachable:   
		std::cout<<"error::host_unreachable  "<<std::endl;
		break;

	case error::in_progress:   
		std::cout<<"error::in_progress  "<<std::endl;
		break;


	case error::interrupted:   
		std::cout<<"error::interrupted  "<<std::endl;
		break;

	case error::invalid_argument:   
		std::cout<<"error::invalid_argument  "<<std::endl;
		break;


	case error::message_size:   
		std::cout<<"error::message_size  "<<std::endl;
		break;

	case error::name_too_long:   
		std::cout<<"error::name_too_long  "<<std::endl;
		break;

	case error::network_down:   
		std::cout<<"error::network_down  "<<std::endl;
		break;

	case error::network_reset:   
		std::cout<<"error::network_reset  "<<std::endl;
		break;

	case error::network_unreachable:   
		std::cout<<"error::network_unreachable  "<<std::endl;
		break;

	case error::no_descriptors:   
		std::cout<<"error::no_descriptors  "<<std::endl;
		break;

	case error::no_buffer_space:   
		std::cout<<"error::no_buffer_space  "<<std::endl;
		break;

	case error::no_memory:   
		std::cout<<"error::no_memory  "<<std::endl;
		break;

	case error::no_permission:   
		std::cout<<"error::no_permission  "<<std::endl;
		break;

	case error::no_protocol_option:   
		std::cout<<"error::no_protocol_option  "<<std::endl;
		break;
	case error::not_connected:   
		std::cout<<"error::not_connected  "<<std::endl;
		break;
	case error::not_socket:   
		std::cout<<"error::not_socket  "<<std::endl;
		break;

	case error::operation_aborted:   
		std::cout<<"error::operation_aborted  "<<std::endl;
		break;

	case error::operation_not_supported:   
		std::cout<<"error::operation_not_supported  "<<std::endl;
		break;

	case error::shut_down:   
		std::cout<<"error::shut_down  "<<std::endl;
		break;

	case error::timed_out:   
		std::cout<<"error::timed_out  "<<std::endl;
		break;

	case error::try_again:   
		std::cout<<"error::try_again  "<<std::endl;
		break;

	case error::would_block:   
		std::cout<<"error::would_block  "<<std::endl;
		break;
	default:
		std::cout<<"unkonw  "<<std::endl;
		break;
	}
}
示例#4
0
 static std::string convert ( const system::error_code & ec )
 {
     return str ( format ( "%s (%i)" )
                           % ec.message ()
                           % ec.value () );
 }