Class Socket
#include <Socket.h >
int bytesWritten |
|
int linesWritten |
|
int bytesRead |
|
int linesRead |
const string& host |
The hostname to connect to (if empty, then localhost) |
int port |
The remote TCP port to connect to |
Prepare for a TCP socket connection
Return value: instance of Socket to open(). If FALSE, check errno().
Open the TCP connection
Return value: TRUE if connected, FALSE otherwise. If FALSE, check errno().
string host |
|
int port |
Close the TCP connection
Return value: TRUE if closed, FALSE otherwise. If FALSE, check errno().
Determine if socket is open/active
Return value: TRUE if socket is closed
Determine if the socket connection has hit EOF
Return value: TRUE if EOF detected
Get the file descriptor (for select() of socket)
Return value: file descriptor
Get the last known error state after a Socket method is called
Return value: the value of errno after the last I/O call
int seconds |
|
int useconds |
Default value: 0 |
bool exitOnInterrupt |
Default value: false |
Sleep the specified number of seconds and microseconds
Return value: true if full time elapsed, false otherwise
bool wait |
Default value: false |
Determine if socket is ready to be read (it has input)
Return value: TRUE if data ready to be read
bool wait |
Default value: false |
Determine if socket is ready to be written
Return value: TRUE if data ready to be written
Check if any signal was received during I/O (EINTR)
Return value: true if a signal was raised
Clear the flag that a signal was raised
bool locked |
Signal is locked when being serviced
const string& text |
The text scring to write |
Write out the specified bytes to the socket
Return value: the number of bytes successfully written
char c |
the character to write |
Write out a single character to socket
Return value: the number of characters successfully written (1 or 0).
bool wait |
Default value: true |
bool ignoreSignal |
Default value: false |
Read text up to a newline.
Return value: the string read. If empty, check errno().
bool nodelay |
Disable buffering on socket.
Return value: TRUE if operation successful, FALSE otherwise.
string host_ |
|
int port_ |
|
int fd_ |
|
int errno_ |
|
bool eof_ |
|
bool signal_ |
|
bool signal_lock_ |