ArNetworking: ArNetPacketReceiverTcp Class Reference

- Main Page
- Classes
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# ArNetPacketReceiverTcp Class Reference

`#include <ArNetPacketReceiverTcp.h>`

List of all members.

## Detailed Description

This class receives TCP packets from a socket, you need to have an open socket and give it to the socket with setSocket, then you need to set up a callback to process packets with setProcessPacketCB, finally call readData which will read in all the data and call the processPacketCB.

## Public Member Functions
| ArNetPacketReceiverTcp ()
| Constructor.
ArFunctor1< ArNetPacket * > * | getProcessPacketCB (void)
| Gets the callback used when a packet is received.
bool | getQuiet (void)
| Gets whether we're quiet about errors or not.
ArSocket * | getSocket (void)
| Gets the socket this receiver uses.
bool | readData (void)
| Reads in all the data available calling the processPacketCB.
void | setLoggingPrefix (const char *loggingPrefix)
| Sets the logging prefix.
void | setProcessPacketCB (ArFunctor1< ArNetPacket * > *functor)
| Sets the callback for use when a packet is received.
void | setQuiet (bool quiet)
| Sets whether we're quiet about errors or not.
void | setSocket (ArSocket *socket)
| Sets the socket this receiver uses.
| ~ArNetPacketReceiverTcp ()
| Destructor.
## Protected Types
enum | { TOTAL_PACKET_LENGTH = ArNetPacket::MAX_LENGTH+ArNetPacket::HEADER_LENGTH+ArNetPacket::FOOTER_LENGTH }
enum | Ret { RET_CONN_CLOSED, RET_GOT_PACKET, RET_BAD_PACKET, RET_FAILED_READ, RET_TIMED_OUT }
enum | State { STATE_SYNC1, STATE_SYNC2, STATE_LENGTH1, STATE_LENGTH2, STATE_ACQUIRE_DATA }
## Protected Member Functions
Ret | readPacket (int msWait)
| Reads in a single packet, returns NULL if not one.
## Protected Attributes
ArTime | myLastPacket
std::string | myLoggingPrefix
ArNetPacket | myPacket
ArFunctor1< ArNetPacket * > * | myProcessPacketCB
bool | myQuiet
char | myReadBuff [TOTAL_PACKET_LENGTH]
int | myReadCommand
int | myReadCount
int | myReadLength
ArSocket * | mySocket
State | myState
unsigned char | mySync1
unsigned char | mySync2

The documentation for this class was generated from the following file:

- ArNetPacketReceiverTcp.h