HTTP_Client is intended to provide application API to classes that wish to do network i/o at a very high level of abstraction. More...
#include <HTTP_Client.h>
Public Member Functions | |
TAO_HTTP_Client (void) | |
~TAO_HTTP_Client (void) | |
int | open (const ACE_TCHAR *filename, const ACE_TCHAR *hostname=ACE_DEFAULT_SERVER_HOST, u_short port=80) |
int | read (ACE_Message_Block *mb) |
int | close () |
Frees memory allocated for filename. | |
Private Attributes | |
ACE_INET_Addr | inet_addr_ |
Store the internet address of the server. | |
ACE_TCHAR * | filename_ |
The filename. | |
ACE_Connector < TAO_HTTP_Handler, ACE_SOCK_CONNECTOR > | connector_ |
The connector endpoint to initiate the client connection. |
HTTP_Client is intended to provide application API to classes that wish to do network i/o at a very high level of abstraction.
This class provides the ability to retrieve data from the network, of specified length and offset, and potentially use any protocol "under the hood" to do so. It currently uses HTTP. See HTTP_Handler also.
Definition at line 52 of file HTTP_Client.h.
TAO_HTTP_Client::TAO_HTTP_Client | ( | void | ) |
Definition at line 12 of file HTTP_Client.cpp.
{ }
TAO_HTTP_Client::~TAO_HTTP_Client | ( | void | ) |
Definition at line 16 of file HTTP_Client.cpp.
{ this->close (); }
int TAO_HTTP_Client::close | ( | void | ) |
Frees memory allocated for filename.
Definition at line 49 of file HTTP_Client.cpp.
{ if (this->filename_) { ACE_OS::free ((void *) this->filename_); this->filename_ = 0; } return 0; }
int TAO_HTTP_Client::open | ( | const ACE_TCHAR * | filename, | |
const ACE_TCHAR * | hostname = ACE_DEFAULT_SERVER_HOST , |
|||
u_short | port = 80 | |||
) |
Initializes the class with the given filename, hostname and port. it should be called with the filename, before any read/write calls
Definition at line 22 of file HTTP_Client.cpp.
{ this->filename_ = ACE_OS::strdup (filename); this->inet_addr_.set (port, hostname); return 0; }
int TAO_HTTP_Client::read | ( | ACE_Message_Block * | mb | ) |
Starts a connection, and reads a file from the server into Message_Block mb
Definition at line 32 of file HTTP_Client.cpp.
{ // Create a HTTP_Client Reader TAO_HTTP_Reader HTTP_reader (mb, this->filename_); TAO_HTTP_Handler *brp = &HTTP_reader; // Connect to the server if (connector_.connect (brp, this->inet_addr_) == -1) { ACE_ERROR_RETURN ((LM_ERROR, "TAO (%P|%t) - HTTP_Client::read, Connector error\n"), -1); } return HTTP_reader.byte_count (); }
ACE_Connector<TAO_HTTP_Handler, ACE_SOCK_CONNECTOR> TAO_HTTP_Client::connector_ [private] |
The connector endpoint to initiate the client connection.
Definition at line 79 of file HTTP_Client.h.
ACE_TCHAR* TAO_HTTP_Client::filename_ [private] |
The filename.
Definition at line 76 of file HTTP_Client.h.
ACE_INET_Addr TAO_HTTP_Client::inet_addr_ [private] |
Store the internet address of the server.
Definition at line 73 of file HTTP_Client.h.