TCP socket for network communication. More...
#include <MSocket.h>
Public Member Functions | |
| MSocket () | |
| virtual | ~MSocket () |
| bool | connect (const mstr &host, int port) |
| virtual void | onConnect () |
| virtual void | close (bool manual=true) |
| int | send (char *buf, size_t len) |
| int | send (char *buf, size_t len, const mtime &timeout) |
| int | receive (char *buf, size_t len) |
| int | receive (char *buf, size_t len, const mtime &time) |
| const mstr & | host () |
Static Public Member Functions | |
| static bool | isLocalHost (const mstr &host) |
Friends | |
| class | MSocket_ |
TCP socket for network communication.
| Meta::MSocket::MSocket | ( | ) |
Constructor.
| virtual Meta::MSocket::~MSocket | ( | ) | [virtual] |
Destructor.
| virtual void Meta::MSocket::close | ( | bool | manual = true |
) | [virtual] |
Close the socket connection.
| manual | true if the socket was closed manually, as opposed to transmission error/loss of connection. |
Reimplemented in Meta::MCommunicator.
| bool Meta::MSocket::connect | ( | const mstr & | host, | |
| int | port | |||
| ) |
Connect to a host.
| const mstr& Meta::MSocket::host | ( | ) |
| static bool Meta::MSocket::isLocalHost | ( | const mstr & | host | ) | [static] |
| virtual void Meta::MSocket::onConnect | ( | ) | [virtual] |
Called when this socket successfully connects. Useful when MSocket is extended.
Reimplemented in Meta::MCommunicator.
| int Meta::MSocket::receive | ( | char * | buf, | |
| size_t | len, | |||
| const mtime & | time | |||
| ) |
Receive a data buffer of length len, blocking until completion or timeout is reached.
| int Meta::MSocket::receive | ( | char * | buf, | |
| size_t | len | |||
| ) |
Receive a data buffer of length len, blocking until completion.
| int Meta::MSocket::send | ( | char * | buf, | |
| size_t | len, | |||
| const mtime & | timeout | |||
| ) |
Send a data buffer of length len, blocking until all data is transmitted or timeout is reached.
| int Meta::MSocket::send | ( | char * | buf, | |
| size_t | len | |||
| ) |
Send a data buffer of length len, blocking until all data is transmitted.
1.6.1