TCP Interface Overview

Connect to Telnet, HTTP servers, mail servers, or other TCPInterface, found at TCPInterface.h, is a utility class designed to connect using the TCP protocol in cases where this is necessary. The connection process is similar to RakPeerInterface.h, with the exception that Receive() returns the actual data received, the first byte does not contain any specific identifiers. To get connection status updates, use HasNewConnection() and HasLostConnection() There is no sample that uses the TCPInterface class specifically, but TelnetTransport.cpp is a good place to look for a reference. Functions: // Starts the TCP server on the indicated port bool Start(unsigned short port, unsigned short maxIncomingConnections); // Stops the TCP server void Stop(void); // Connect to the specified host on the specified port SystemAddress Connect(const char* host, unsigned short remotePort); // Sends a byte stream void Send( const char *data, unsigned length, SystemAddress systemAddress ); // Returns data received Packet* Receive( void ); // Disconnects a player/address void CloseConnection( SystemAddress systemAddress ); // Deallocates a packet returned by Receive void DeallocatePacket( Packet *packet ); // Queued events of new connections SystemAddress HasNewConnection(void); // Queued events of lost connections SystemAddress HasLostConnection(void);

See Also

Index TCP (Wikipedia) Email Sender