Skip to content
This repository has been archived by the owner on Apr 6, 2019. It is now read-only.

Commit

Permalink
add get_host and get_port methods to tcp_client
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Ninon committed Jun 10, 2017
1 parent 3482d89 commit a6b6010
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
7 changes: 6 additions & 1 deletion includes/tacopie/network/tcp_client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class tcp_client {
bool operator==(const tcp_client& rhs) const;
bool operator!=(const tcp_client& rhs) const;

public:
//! get host & port information
const std::string& get_host(void) const;
std::uint32_t get_port(void) const;

public:
//! start & stop the tcp client
void connect(const std::string& addr, std::uint32_t port);
Expand Down Expand Up @@ -148,4 +153,4 @@ class tcp_client {
disconnection_handler_t m_disconnection_handler;
};

} //! tacopie
} // namespace tacopie
16 changes: 15 additions & 1 deletion sources/network/tcp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ tcp_client::tcp_client(tcp_socket&& socket)
m_io_service->track(m_socket);
}

//!
//! get host & port information
//!

const std::string&
tcp_client::get_host(void) const {
return m_socket.get_host();
}

std::uint32_t
tcp_client::get_port(void) const {
return m_socket.get_port();
}

//!
//! start & stop the tcp client
//!
Expand Down Expand Up @@ -268,4 +282,4 @@ tcp_client::operator!=(const tcp_client& rhs) const {
return !operator==(rhs);
}

} //! tacopie
} // namespace tacopie

0 comments on commit a6b6010

Please sign in to comment.