![]() |
The Open Master Hearing Aid (openMHA)
openMHA
Open community platform for hearing aid algorithm research
|
A portable class for a tcp client connections. More...

Public Member Functions | |
| Client (const std::string &host, unsigned short port) | |
| Constructor connects to host, port via TCP. More... | |
| Client (const std::string &host, unsigned short port, Timeout_Watcher &timeout_watcher) | |
| Constructor connects to host, port via TCP, using a timeout. More... | |
Public Member Functions inherited from MHA_TCP::Connection | |
| Sockread_Event * | get_read_event () |
| Sockwrite_Event * | get_write_event () |
| std::string | get_peer_address () |
| Get peer's IP Address. More... | |
| unsigned short | get_peer_port () |
| Get peer's TCP port. More... | |
| SOCKET | get_fd () const |
| Return the (protected) file descriptor of the connection. More... | |
| virtual | ~Connection () |
| Destructor closes the underlying file descriptor. More... | |
| bool | eof () |
| Checks if the peer has closed the connection. More... | |
| bool | can_read_line (char delim='\n') |
| Checks if a full line of text has arrived by now. More... | |
| bool | can_read_bytes (unsigned howmany) |
| Checks if the specified ammount of data can be read. More... | |
| std::string | read_line (char delim='\n') |
| Reads a single line of data from the socket. More... | |
| std::string | read_bytes (unsigned howmany) |
| Reads the specified ammount of dat from the socket. More... | |
| void | try_write (const std::string &data="") |
| Adds data to the internal "outgoing" buffer, and then tries to write as much data from that buffer to the socket as possible without blocking. More... | |
| void | write (const std::string &data="") |
| Adds data to the internal "outgoing" buffer, and then writes that that buffer to the socket, regardless of blocking. More... | |
| bool | needs_write () |
| Checks if the internal "outgoing" buffer contains data. More... | |
| unsigned | buffered_incoming_bytes () const |
| Returns the number of bytes in the internal "incoming" buffer. More... | |
| unsigned | buffered_outgoing_bytes () const |
| Returns the number of bytes in the internal "outgoing" buffer. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from MHA_TCP::Connection | |
| Connection (SOCKET _fd) | |
| Create a connection instance from a socket filedescriptor. More... | |
Protected Attributes inherited from MHA_TCP::Connection | |
| SOCKET | fd |
| The file descriptor of the TCP Socket. More... | |
A portable class for a tcp client connections.
| Client::Client | ( | const std::string & | host, |
| unsigned short | port | ||
| ) |
| Client::Client | ( | const std::string & | host, |
| unsigned short | port, | ||
| Timeout_Watcher & | timeout_watcher | ||
| ) |