added udp connect method / local ip lookup
This commit is contained in:
parent
e7a6256c8b
commit
c7ce00202a
3 changed files with 11 additions and 1 deletions
|
|
@ -29,6 +29,7 @@ namespace fc {
|
||||||
/** returns "IP:PORT" */
|
/** returns "IP:PORT" */
|
||||||
operator string()const;
|
operator string()const;
|
||||||
|
|
||||||
|
void set_port(uint16_t p ) { _port = p; }
|
||||||
uint16_t port()const;
|
uint16_t port()const;
|
||||||
const address& get_address()const;
|
const address& get_address()const;
|
||||||
|
|
||||||
|
|
@ -40,5 +41,4 @@ namespace fc {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool operator==( const fc::ip::endpoint& a, const fc::ip::endpoint& b );
|
|
||||||
#endif // _FC_ENDPOINT_HPP_
|
#endif // _FC_ENDPOINT_HPP_
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ namespace fc {
|
||||||
size_t send_to( const char* b, size_t l, const fc::ip::endpoint& to );
|
size_t send_to( const char* b, size_t l, const fc::ip::endpoint& to );
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
void connect( const fc::ip::endpoint& e );
|
||||||
|
fc::ip::endpoint local_endpoint()const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class impl;
|
class impl;
|
||||||
fwd<impl,32> my;
|
fwd<impl,32> my;
|
||||||
|
|
|
||||||
|
|
@ -78,4 +78,11 @@ namespace fc {
|
||||||
my->_sock.close();
|
my->_sock.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fc::ip::endpoint udp_socket::local_endpoint()const {
|
||||||
|
return to_fc_ep( my->_sock.local_endpoint() );
|
||||||
|
}
|
||||||
|
void udp_socket::connect( const fc::ip::endpoint& e ) {
|
||||||
|
my->_sock.connect( to_asio_ep(e) );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue