Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phSocket Class Reference
[NetworkThread Safe]

#include <phSocket.h>

Inheritance diagram for phSocket:

phMutex phObject phNodeControllerClient phServerSocket List of all members.

Detailed Description

A simple client-side socket communication layer.

Definition at line 93 of file phSocket.h.

Public Member Functions

 phSocket (const char *host=(const char *) NULL, const int port=0)
 ~phSocket ()
int setSrcPort (int port)
int getSrcPort ()
int setDstPort (int port)
int getDstPort ()
int setSrcHost (const char *host)
const char * getSrcHost ()
int setDstHost (const char *host)
const char * getDstHost ()
int connect (const char *host=(const char *) NULL, const int port=0, const bool polling=true)
void disconnect ()
int send (const void *data, const int len)
int recv (void *data, const int len)
int recv (void *data, const int len, int &recv_len, int wait)
bool isReady ()
bool isConnected ()
void wakeup ()
int setBlocking (int set_blocking=phBLOCK)
int setLinger (int set_linger=phLINGER, uint32_t linger_time=0)
int setSock (int newSock)
int isSelfConnected ()
int setWarningLevel (int level=0)
int getWarningLevel ()
void setCallShutdown (int sd)
int recv_int32 (int32_t *i)
int send_int32 (int32_t d)
int recv_uint32 (uint32_t *i)
int send_uint32 (uint32_t d)
int recv_int16 (int16_t *i)
int send_int16 (int16_t d)
int recv_uint16 (uint16_t *i)
int send_uint16 (uint16_t d)
virtual int print_object (FILE *fd)

Static Public Member Functions

static uint32_t hton32 (uint32_t var)
static uint32_t ntoh32 (uint32_t var)
static uint16_t hton16 (uint16_t var)
static uint16_t ntoh16 (uint16_t var)

Protected Member Functions

int allocBuffer (uint8_t **buf, uint32_t *len, uint32_t length)
int initSocketVar ()
int applyBlocking ()
int applyLinger ()
int updateDstFromSock ()
int updateSrcFromSock ()
void * getSrcSinPtr ()
void * getDstSinPtr ()
void setSocket (int32_t sock)
int32_t getSocket ()
int lastSocketError ()
int lastSystemError ()

Protected Attributes

int m_dst_port
char * m_dst_host
uint32_t m_dst_host_size
int m_src_port
char * m_src_host
uint32_t m_src_host_size
char * m_temp_buf
uint32_t m_temp_buf_size
phMutex m_send_lock
phMutex m_recv_lock
int m_family
int m_socket_type
int m_protocol
int m_call_shutdown
ph_socket_info m_info
bool m_connected
int m_warning_level
volatile int m_exit_trigger
int m_blocking
int m_linger
int m_linger_time

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

Copyright (C) 2002 - 2007 Philip D.S. Thoren ( )
University Of Massachusetts at Lowell
Robotics Lab Logo

Generated on Sat Jun 16 02:45:13 2007 for phission by  doxygen 1.4.4