예제 #1
0
 void tcp_socket::bind(const fc::ip::endpoint& local_endpoint)
 {
   try
   {
     my->_sock.bind(boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4(local_endpoint.get_address()),
                                                                               local_endpoint.port()));
   }
   catch (const std::exception& except)
   {
     elog("Exception binding outgoing connection to desired local endpoint ${endpoint}: ${what}", ("endpoint", local_endpoint)("what", except.what()));
     FC_THROW("error binding to ${endpoint}: ${what}", ("endpoint", local_endpoint)("what", except.what()));
   }
 }
예제 #2
0
파일: udp_socket.cpp 프로젝트: DerKorb/fc
 boost::asio::ip::udp::endpoint to_asio_ep( const fc::ip::endpoint& e ) {
   return boost::asio::ip::udp::endpoint(boost::asio::ip::address_v4(e.get_address()), e.port() );
 }
예제 #3
0
파일: tcp_socket.cpp 프로젝트: DerKorb/fc
 void tcp_socket::connect_to( const fc::ip::endpoint& e ) {
   fc::asio::tcp::connect(my->_sock, fc::asio::tcp::endpoint( boost::asio::ip::address_v4(e.get_address()), e.port() ) ); 
 }
예제 #4
0
 void tcp_server::listen( const fc::ip::endpoint& ep ) 
 {
   if( !my ) 
     my = new impl;
   try
   {
     my->_accept.bind(boost::asio::ip::tcp::endpoint(boost::asio::ip::address_v4::from_string((string)ep.get_address()), ep.port()));
     my->_accept.listen();
   } 
   FC_RETHROW_EXCEPTIONS(warn, "error listening on socket");
 }
예제 #5
0
 void tcp_socket::connect_to( const fc::ip::endpoint& remote_endpoint ) {
   fc::asio::tcp::connect(my->_sock, fc::asio::tcp::endpoint( boost::asio::ip::address_v4(remote_endpoint.get_address()), remote_endpoint.port() ) ); 
 }