HTTPClient Class Reference

Interface to a HTTPClient port. More...

#include <Devices/HTTPClient.H>

Inheritance diagram for HTTPClient:
Inheritance graph
[legend]
Collaboration diagram for HTTPClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 HTTPClient (OptionManager &mgr, const std::string &descrName="HTTPClient Port", const std::string &tagName="HTTPClientPort")
 Constructor.
 ~HTTPClient (void)
 destructor
int read (void *buffer, const int nbytes)
 write bytes from the port
int write (const void *buffer, const int nbytes)
 write bytes to the port
std::string sendGetRequest (const std::string &request)
 send request to the http server
std::string sendPostRequest (const std::string &request, const char *data, long size)
 send Post data to the http server
std::string readData ()
 get data back
void openConnection ()
 Connect to the server.
void closeConnection ()
 Close the connection.

Protected Member Functions

std::string getIPAddress (const std::string &hostName)
 Resolve hostname to ip address.
void start1 ()
 open the port and get started
void stop2 ()
 close the port and get stopped

Protected Attributes

OModelParam< std::stringitsHostName
OModelParam< unsigned int > itsPort
 The host to contact.

Detailed Description

Interface to a HTTPClient port.

The socket will be open at start() time; see ModelComponent.H for details.

Definition at line 58 of file HTTPClient.H.


Constructor & Destructor Documentation

HTTPClient::HTTPClient ( OptionManager mgr,
const std::string descrName = "HTTPClient Port",
const std::string tagName = "HTTPClientPort" 
)

Constructor.

Definition at line 63 of file HTTPClient.C.

HTTPClient::~HTTPClient ( void   ) 

destructor

Definition at line 267 of file HTTPClient.C.


Member Function Documentation

void HTTPClient::closeConnection (  ) 

Close the connection.

Definition at line 113 of file HTTPClient.C.

Referenced by sendGetRequest(), and sendPostRequest().

std::string HTTPClient::getIPAddress ( const std::string hostName  )  [protected]

Resolve hostname to ip address.

Definition at line 122 of file HTTPClient.C.

Referenced by openConnection().

void HTTPClient::openConnection (  ) 

Connect to the server.

Definition at line 81 of file HTTPClient.C.

References getIPAddress(), OModelParam< T >::getVal(), and itsPort.

Referenced by sendGetRequest(), and sendPostRequest().

int HTTPClient::read ( void *  buffer,
const int  nbytes 
)

write bytes from the port

Definition at line 149 of file HTTPClient.C.

std::string HTTPClient::readData (  ) 

get data back

Definition at line 236 of file HTTPClient.C.

Referenced by sendGetRequest().

std::string HTTPClient::sendGetRequest ( const std::string request  ) 

send request to the http server

Definition at line 164 of file HTTPClient.C.

References closeConnection(), openConnection(), and readData().

std::string HTTPClient::sendPostRequest ( const std::string request,
const char *  data,
long  size 
)

send Post data to the http server

Definition at line 193 of file HTTPClient.C.

References closeConnection(), and openConnection().

void HTTPClient::start1 (  )  [protected, virtual]

open the port and get started

Reimplemented from ModelComponent.

Definition at line 75 of file HTTPClient.C.

void HTTPClient::stop2 (  )  [protected, virtual]

close the port and get stopped

Reimplemented from ModelComponent.

Definition at line 141 of file HTTPClient.C.

int HTTPClient::write ( const void *  buffer,
const int  nbytes 
)

write bytes to the port

Definition at line 157 of file HTTPClient.C.


Member Data Documentation

OModelParam<unsigned int> HTTPClient::itsPort [protected]

The host to contact.

The port to contact on

Definition at line 95 of file HTTPClient.H.

Referenced by openConnection().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:21 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3