added remote_endpoint() call to tcp_socket
This commit is contained in:
parent
134fe467c5
commit
d5771acd3d
2 changed files with 6 additions and 0 deletions
|
|
@ -12,6 +12,7 @@ namespace fc {
|
||||||
~tcp_socket();
|
~tcp_socket();
|
||||||
|
|
||||||
void connect_to( const fc::ip::endpoint& e );
|
void connect_to( const fc::ip::endpoint& e );
|
||||||
|
fc::ip::endpoint remote_endpoint()const;
|
||||||
|
|
||||||
/// istream interface
|
/// istream interface
|
||||||
/// @{
|
/// @{
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,11 @@ namespace fc {
|
||||||
return fc::asio::write_some( my->_sock, boost::asio::buffer( buf, len ) );
|
return fc::asio::write_some( my->_sock, boost::asio::buffer( buf, len ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fc::ip::endpoint tcp_socket::remote_endpoint()const
|
||||||
|
{
|
||||||
|
auto rep = my->_sock.remote_endpoint();
|
||||||
|
return fc::ip::endpoint(rep.address().to_v4().to_ulong(), rep.port() );
|
||||||
|
}
|
||||||
|
|
||||||
size_t tcp_socket::readsome( char* buf, size_t len ) {
|
size_t tcp_socket::readsome( char* buf, size_t len ) {
|
||||||
auto r = fc::asio::read_some( my->_sock, boost::asio::buffer( buf, len ) );
|
auto r = fc::asio::read_some( my->_sock, boost::asio::buffer( buf, len ) );
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue