Class Hierarchy   Class Index   Method Index  

CHMllpConnection Class Reference

#include <CHMllpConnection.h>


Detailed Description

This object is passed as an argument for many of the events of the CHMllpServer object.

This class provides methods to interact with each discrete client connection.

See http://www.interfaceware.com/manual/network_components.html for more information.


Public Member Functions

 CHMllpConnection ()
 Constructor.
virtual ~CHMllpConnection ()
 Destructor.
CHMllpConnectionoperator= (const CHMllpConnection &Orig)
 Assignment operator.
CHMconnectionHandle GetHandle () const
 This method is part of the internal implementation of this class and should not be called.
const char * RemoteHostName () const
 This property will resolve the remoteIpAddress to the host name if possible using the operating system.
CHMint32 Id () const
 A unique ID for all connection objects.
CHMint32 RemoteIpAddress () const
 The IP address of the remote host in host byte order.
const char * RemoteIpAddressAsString () const
 The IP address of the remote host as a string.
void TransmitMessage (const char *Message)
 Send a message to the client, prefixed and postfixed by the current CHMllpServer::HeaderBlock and CHMllpServer::TrailerBlock characters.
void Disconnect ()
 Attempt to gracefully disconnect from the server.
void HardDisconnect ()
 Ungracefully disconnect without doing TCP/IP handshaking with the server.


Constructor & Destructor Documentation

CHMllpConnection::CHMllpConnection  ) 
 

Constructor.

virtual CHMllpConnection::~CHMllpConnection  )  [virtual]
 

Destructor.


Member Function Documentation

void CHMllpConnection::Disconnect  ) 
 

Attempt to gracefully disconnect from the server.

A graceful disconnect implies a shutdown to the write end of the connection, and reading all data until the peer issues a close to its write end.

Note that the peer may not actually close the write end of its connection (although this is rare), which results in the connection never receiving the close event to signify that the connection is closed. In this situation, it is recommended that CHMllpConnection::HardDisconnect be called to close the connection.

Function requires a running message loop (see CHMllpServer::RunMessageLoop).

Blocking: Function does not block.
Events: If the close succeeds (the peer closes the connection), a CHMllpServer::OnClientDisconnected event results. If an error occurs during the close operation, an CHMllpServer::OnClientErrorReceived event results, containing the error message indicating why the close attempt failed.

CHMconnectionHandle CHMllpConnection::GetHandle  )  const [inline]
 

This method is part of the internal implementation of this class and should not be called.

void CHMllpConnection::HardDisconnect  ) 
 

Ungracefully disconnect without doing TCP/IP handshaking with the server.

If there is data pending on the network buffer to be sent, the peer will receive a reset on the connection if it attempts to read or write to the connection.

Blocking: Function blocks; upon returning, the connection is closed.
Events: None.

CHMint32 CHMllpConnection::Id  )  const
 

A unique ID for all connection objects.

This ID is generated sequentially (i.e. 0, 1, 2, 3, etc.) for all connections received from a LlpServer, beginning at 0 when the application starts. The ID is globally unique and will allow users to identify connections from the same client, or connections from different clients.

CHMllpConnection& CHMllpConnection::operator= const CHMllpConnection Orig  ) 
 

Assignment operator.

const char* CHMllpConnection::RemoteHostName  )  const
 

This property will resolve the remoteIpAddress to the host name if possible using the operating system.

Sometimes no host name resolution will be possible at which point this function will return 'unknown'.

For the first time this method is called, it blocks until the name is resolved. This means that if you make the call in the context of your message loop your application will appear to freeze for a few seconds.

Subsequent calls will return immediately with a cached value.

For more advanced functionality you may wish to use other facilities to resolve the host name outside of the functionality offered here.

CHMint32 CHMllpConnection::RemoteIpAddress  )  const
 

The IP address of the remote host in host byte order.

Consider using CHMllpConnection::RemoteIpAddressAsString instead for a more usable format.

const char* CHMllpConnection::RemoteIpAddressAsString  )  const
 

The IP address of the remote host as a string.

See also CHMllpConnection::RemoteIpAddress.

void CHMllpConnection::TransmitMessage const char *  Message  ) 
 

Send a message to the client, prefixed and postfixed by the current CHMllpServer::HeaderBlock and CHMllpServer::TrailerBlock characters.

The data is not guaranteed to be received after this function is called. All data is buffered internally; completion of this call does not signify reception of data.

Function requires a running message loop (see CHMllpServer::RunMessageLoop).

Blocking: Function does not block.
Events: If an error occurs during the send operation, an CHMllpServer::OnClientErrorReceived event results, containing the error message indicating why the send attempt has failed.

Parameters:
Message HL7 message to send to a client connection in plain string format.


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