#include <CHMhl7ClientSocket.h>
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.
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 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.
|
|
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.
|
|
Destructor.
|
|
Close a connection. Closes the connection to the remote host. If the connection has already been closed this function does nothing. |
|
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.
|
|
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.
|
|
Get the raw IP address.
|
|
Get the IP address as a string.
|
|
the identidy of the client
|
|
True when the connection is open.
|
|
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. |
|
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. |
|
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.
|