Class Hierarchy   Class Index   Method Index  

CHMhl7ClientSocket Class Reference

#include <CHMhl7ClientSocket.h>


Detailed Description

Deprecated Client class for asynchronous TCP/IP communication.

The CHMhl7ClientSocket represents a TCP/IP connection between two computers. You can use this class to connect to a server and send/receive messages. The messages are automatically wrapped and unwrapped using the LLP protocol. To implement a CHMhl7ClientSocket you must create a new class that inheirits from it. This way you can override the virtual methods to handle the network events.

Deprecated:


Public Member Functions

 CHMhl7ClientSocket (CHMboolean Dynamic=false)
 Constructor Constructor used for a client connecting to a server.
 CHMhl7ClientSocket (int ClientId, CHMboolean Dynamic=true)
 Constructor Constructor used for a server accepting a client's connection.
virtual ~CHMhl7ClientSocket ()
 Destructor.
void connect (const char *Host, short Port)
 Connect to a remote host.
void sendMessage (const char *Message)
 Send a message.
CHMuint32 getIpAddress ()
 Get the raw IP address.
const char * getIpAddressString ()
 Get the IP address as a string.
const char * getHostName ()
 Gets the host name.
void closeConnection ()
 Close a connection.
virtual void onConnect ()
 Called when a connection has been established.
CHMboolean isConnected () const
 True when the connection is open.
virtual void onClose (CHMhl7ClientSocket &Client)
 Called when a connection closes This function is called after a connection has been closed by the remote host.
int id ()
 the identidy of the client


Constructor & Destructor Documentation

CHMhl7ClientSocket::CHMhl7ClientSocket CHMboolean  Dynamic = false  ) 
 

Constructor Constructor used for a client connecting to a server.

This constructor is used when you would like to create a object to connect to a remote host.

Parameters:
Dynamic Specifies whether this object should be automatically deleted when the connection closes. If the object in constructed as a stack variable this should be false. Only set this value to true if you create the object with new and don't ever delete it. The default value is false.

CHMhl7ClientSocket::CHMhl7ClientSocket int  ClientId,
CHMboolean  Dynamic = true
 

Constructor Constructor used for a server accepting a client's connection.

This constructor is used when an incoming connection is requested in a server application. The instantiated object represents the server side of the connection.

Parameters:
ClientId Obtained from the OnNewConnection event on CHMhl7ServerSocket. The value is the idetifier of a client connection.
Dynamic Specifies whether this object should be automatically deleted when the connection closes. If the object in constructed as a stack variable this should be false. Only set this value to true if you create the object with new and don't ever delete it. Typically when the OnNewConnection event occurs you dynamically create a new client with this value as true. The default value is true.

virtual CHMhl7ClientSocket::~CHMhl7ClientSocket  )  [virtual]
 

Destructor.


Member Function Documentation

void CHMhl7ClientSocket::closeConnection  ) 
 

Close a connection.

Closes the connection to the remote host. If the connection has already been closed this function does nothing.

void CHMhl7ClientSocket::connect const char *  Host,
short  Port
 

Connect to a remote host.

Requests a new connection to a remote host on a specified port. The call is asynchronous so there is not neccesarily an established connection when the call returns. A connection is established when an onConnect() event occurs. If the connection fails you'll receive an onTransportError() event. Override these virtual methods on a base class to handle these events.

Parameters:
Host The host name or IP address as a string. This can be an IP address string such as "127.0.0.1" a computer name "localhost" or a domain name "interfaceware.com".
Port Specifies the port on the remote host to connect to.

const char* CHMhl7ClientSocket::getHostName  ) 
 

Gets the host name.

This function does a lookup for the host name of the remote host's IP address. If no host name is found then it returns the IP address of the remote host as a string.

Returns:
The host name of the remote host.

CHMuint32 CHMhl7ClientSocket::getIpAddress  ) 
 

Get the raw IP address.

Returns:
The 32 bit integer IP address of the remote host.

const char* CHMhl7ClientSocket::getIpAddressString  ) 
 

Get the IP address as a string.

Returns:
The IP address as a string in the form "127.0.0.1".

int CHMhl7ClientSocket::id  ) 
 

the identidy of the client

Returns:
The unique id of the connection.

CHMboolean CHMhl7ClientSocket::isConnected  )  const
 

True when the connection is open.

virtual void CHMhl7ClientSocket::onClose CHMhl7ClientSocket Client  )  [virtual]
 

Called when a connection closes This function is called after a connection has been closed by the remote host.

After this event occurs the socket is in a disconnected state and cannot send or receive messages. You can reuse the object for another connection using connect() after this event occurs To handle this event you'll need to override this function on a base class.

virtual void CHMhl7ClientSocket::onConnect  )  [inline, virtual]
 

Called when a connection has been established.

This function is called after a connection request using the connect() function has been successful. After this event occurs the connection is in a state to send and receive messages. To handle this event you'll need to override this function on a base class.

void CHMhl7ClientSocket::sendMessage const char *  Message  ) 
 

Send a message.

Sends a message on the connection to the remote host. This call automatically wraps the message with the LLP header and footer. The object must be connected to send a message.

Parameters:
Message A null terminated string representing the message that should be sent.


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