basic_connection Class Template Reference
[Network Library]

#include <inetstl/network/connection.hpp>

List of all members.


Detailed Description

template<typename C, typename X = throw_internet_exception_policy, typename T = filesystem_traits<C>>
class inetstl::basic_connection< C, X, T >

Represents an internet connection.

Public Types

typedef C char_type
typedef X exception_policy_type
typedef
exception_policy_type::thrown_type 
thrown_type
typedef T traits_type
typedef basic_connection< C, X, T > class_type
typedef HINTERNET resource_type

Public Member Functions

 basic_connection ()
 Default constructor.
 basic_connection (HINTERNET hsess, char_type const *server, INTERNET_PORT port, char_type const *userName, char_type const *password, is_dword_t service, is_dword_t flags, is_dword_t context=0)
 Create a connection with the given arguments.
 ~basic_connection () throw ()
 Closes the connection, if open.
bool connect (HINTERNET hsess, char_type const *server, INTERNET_PORT port, char_type const *userName, char_type const *password, is_dword_t service, is_dword_t flags, is_dword_t context=0)
 Opens a connection with the given arguments.
void close ()
 Closes the connection, if open.
HINTERNET detach ()
 Removes the connection from this object, and returns the underlying WinInet handle to the caller, who must take responsibility for releasing it.
bool is_connected () const
 Indicates whether the object is managing an open connection.
is_dword_t last_error () const
 The last Win32/WinInet error associated with this connection object.
HINTERNET get () const
 The underlying WinInet handle.
 operator HINTERNET ()
 Implicit conversion operator to a WinInet handle.

Constructor & Destructor Documentation

basic_connection (  )  [inline]

Default constructor.

Note:
No connection exists. Use connect() to open a connection

basic_connection ( HINTERNET  hsess,
char_type const *  server,
INTERNET_PORT  port,
char_type const *  userName,
char_type const *  password,
is_dword_t  service,
is_dword_t  flags,
is_dword_t  context = 0 
) [inline, explicit]

Create a connection with the given arguments.

Parameters:
hsess A WinInet handle to the current session, obtained via InternetOpen() or the basic_session class
server The name of the server to which to connect. May not be NULL
port The number of the port to connect on
userName The username for the connection. May be NULL
password The password for the connection. May be NULL
service The service to access. Either INTERNET_SERVICE_FTP or INTERNET_SERVICE_HTTP
flags Service specific flags, e.g. INTERNET_FLAG_PASSIVE
context Context used for callback functions
Note:
If the connection fails to open, the exception_policy_type function-call operator is called. If the policy throws an exception, then that exception is thrown. If the policy is "null exception" policy type, then the connection object will be constructed in a closed state.

~basic_connection (  )  throw () [inline]

Closes the connection, if open.


Member Function Documentation

bool connect ( HINTERNET  hsess,
char_type const *  server,
INTERNET_PORT  port,
char_type const *  userName,
char_type const *  password,
is_dword_t  service,
is_dword_t  flags,
is_dword_t  context = 0 
) [inline]

Opens a connection with the given arguments.

Parameters:
hsess A WinInet handle to the current session, obtained via InternetOpen() or the basic_session class
server The name of the server to which to connect. May not be NULL
port The number of the port to connect on
userName The username for the connection. May be NULL
password The password for the connection. May be NULL
service The service to access. Either INTERNET_SERVICE_FTP or INTERNET_SERVICE_HTTP
flags Service specific flags, e.g. INTERNET_FLAG_PASSIVE
context Context used for callback functions
Note:
If the connection fails to open, the exception_policy_type function-call operator is called. If the policy throws an exception, then that exception is thrown. If the policy is "null exception" policy type, then the connection object will be left in a closed state.

References basic_connection::is_connected().

void close (  )  [inline]

Closes the connection, if open.

HINTERNET detach (  )  [inline]

Removes the connection from this object, and returns the underlying WinInet handle to the caller, who must take responsibility for releasing it.

References INETSTL_MESSAGE_ASSERT, and basic_connection::is_connected().

bool is_connected (  )  const [inline]

Indicates whether the object is managing an open connection.

Referenced by basic_connection::connect(), and basic_connection::detach().

is_dword_t last_error (  )  const [inline]

The last Win32/WinInet error associated with this connection object.

HINTERNET get (  )  const [inline]

The underlying WinInet handle.

operator HINTERNET (  )  [inline]

Implicit conversion operator to a WinInet handle.

Deprecated:
This will be removed in a future release


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

Generated on Thu Jun 10 08:58:28 2010 for STLSoft by  doxygen 1.5.6