SimpleSocket
0.1
Some wrappers that make using sockets easier in C++
|
#include <sclasses.hh>
Public Member Functions | |
SocketCommunicator (int fd) | |
Instantiate on top of this file descriptor, which will be set to non-blocking. | |
void | connect (const ComboAddress &a) |
Connect to an address, with the default timeout (which may be infinite) | |
bool | getLine (std::string &line) |
Get a while line of text. Returns false on EOF. Will return a partial last line. With timeout. | |
void | writen (boost::string_ref message) |
Fully write out a message, even in the face of partial writes. With timeout. | |
void | setTimeout (double timeout) |
Set the timeout (in seconds) | |
Convenience class that requires a non-blocking socket as input and supports commonly used operations. SocketCommunicator will modify your socket to be non-blocking. This class will not close or otherwise modify your socket. Note that since SocketCommunicator instantiates a buffered reader on your socket, you should not attempt concurrent reads on the socket as long as SocketCommunicator is active.