MPMA Framework 0.4
|
Represents a stream-based reliable connection to another PC. More...
#include <TCP.h>
Public Member Functions | |
bool | IsConnected () const |
Returns whether the client is still connected to the remote. | |
bool | Send (const void *data, nuint dataLen) |
Sends data to the the remote. Returns false if the send failed. | |
nuint | Receive (std::vector< uint8 > &data, nuint exactBytesToRetrieve=0) |
Receives bytes from the remote and appends it to data. Returns the number of bytes retrieved. If exactBytesToRetrieve is specified, then either exactly that many bytes will be returned from the stream, or none will be. | |
uint16 | GetLocalPort () const |
Returns the local port that the client is using. | |
const Address & | GetRemoteAddress () const |
Returns the address of the remote. | |
void | EnableSendCoalescing (bool allow) |
Improves network bandwidth at the expense of latency (on by default). | |
Static Public Member Functions | |
static TCPClient * | Connect (const Address &addr, uint16 localPort=0) |
Initiates a new connection to a remote host. If localPort is 0, the system will select one automatically. Returns 0 on failure. | |
static void | FreeClient (TCPClient *client) |
Disconnects and frees a client. |
Represents a stream-based reliable connection to another PC.