Aria  2.7.5.2
ArTcpConnection Class Reference

For connectiong to a device through a socket. More...

#include <ArTcpConnection.h>

Inherits ArDeviceConnection.

Public Types

enum  Open { OPEN_NET_FAIL = 1, OPEN_BAD_HOST, OPEN_NO_ROUTE, OPEN_CON_REFUSED }
 
- Public Types inherited from ArDeviceConnection
enum  Status {
  STATUS_NEVER_OPENED = 1, STATUS_OPEN, STATUS_OPEN_FAILED, STATUS_CLOSED_NORMALLY,
  STATUS_CLOSED_ERROR
}
 

Public Member Functions

 ArTcpConnection ()
 Constructor.
 
virtual bool close (void)
 
std::string getHost (void)
 Gets the name of the host connected to. More...
 
virtual const char * getOpenMessage (int messageNumber)
 
int getPort (void)
 Gets the number of the port connected to. More...
 
ArSocketgetSocket (void)
 Gets the socket this tcp connection is using.
 
virtual int getStatus (void)
 
virtual ArTime getTimeRead (int index)
 
int internalOpen (void)
 Internal function used by open and openSimple.
 
virtual bool isTimeStamping (void)
 
int open (const char *host=NULL, int port=8101)
 Opens a connection to the given host and port. More...
 
virtual bool openSimple (void)
 
virtual int read (const char *data, unsigned int size, unsigned int msWait=0)
 
void setPort (const char *host=NULL, int port=8101)
 
void setSocket (ArSocket *socket)
 Sets the tcp connection to use this socket instead of its own. More...
 
void setStatus (int status)
 
virtual int write (const char *data, unsigned int size)
 
virtual ~ArTcpConnection ()
 Destructor also closes connection.
 
- Public Member Functions inherited from ArDeviceConnection
 ArDeviceConnection ()
 constructor
 
const char * getStatusMessage (int messageNumber) const
 Gets the description string associated with the status. More...
 
virtual int writePacket (ArBasePacket *packet)
 Writes data to connection. More...
 
virtual ~ArDeviceConnection ()
 destructor also forces a close on the connection
 

Protected Member Functions

void buildStrMap (void)
 
- Protected Member Functions inherited from ArDeviceConnection
void buildStrMap (void)
 

Protected Attributes

std::string myHostName
 
bool myOwnSocket
 
int myPortNum
 
ArSocketmySocket
 
int myStatus
 
ArStrMap myStrMap
 

Additional Inherited Members

- Static Protected Attributes inherited from ArDeviceConnection
static ArStrMap ourStrMap
 
static bool ourStrMapInited = false
 

Detailed Description

For connectiong to a device through a socket.

Member Enumeration Documentation

Enumerator
OPEN_NET_FAIL 

Some critical part of the network isn't working.

OPEN_BAD_HOST 

Could not find the host.

OPEN_NO_ROUTE 

Know where the host is, but can't get to it.

OPEN_CON_REFUSED 

Got to the host but it didn't allow a connection.

Member Function Documentation

std::string ArTcpConnection::getHost ( void  )

Gets the name of the host connected to.

Returns
the name of the host connected to
See Also
getPort
int ArTcpConnection::getPort ( void  )

Gets the number of the port connected to.

Returns
the number of the port connected to
See Also
getHost
int ArTcpConnection::open ( const char *  host = NULL,
int  port = 8101 
)

Opens a connection to the given host and port.

Parameters
hostthe host to connect to, if NULL (default) then localhost
portthe port to connect to
Returns
0 for success, otherwise one of the open enums
See Also
getOpenMessage
void ArTcpConnection::setSocket ( ArSocket socket)

Sets the tcp connection to use this socket instead of its own.

This will make the connection use this socket, its useful for doing funkier things with sockets but still being able to use a device connection.

Parameters
socketthe socket to use
void ArTcpConnection::setStatus ( int  status)

Sets the status of the device, ONLY use this if you're playing with setSocket and know what you're doing


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