#include <CHMhl7ServerSocket.h>
This should not be used for new applications.
The CHMhl7ServerSocket represents a listener on a port that can receive remote connections. It also supports sending and receiving messages across these connections. The messages are automatically wrapped and unwrapped using the LLP protocol. To implement a CHMhl7ServerSocket 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 | |
CHMhl7ServerSocket () | |
Constructor The default constructor creates a server object that's ready to listen. | |
virtual | ~CHMhl7ServerSocket () |
Destructor. | |
void | listen (short Port) |
Makes server listen on a specified port Calling listen makes this socket start listening on the port specified. | |
void | stopListening () |
Stops the server from listening Calling this method stops the socket from listening on the port specified in the call to listen(). | |
void | sendMessage (int ClientId, const char *Message) |
Send a message. | |
CHMuint32 | getIpAddress (int ClientId) |
Get the raw IP address. | |
const char * | getIpAddressString (int ClientId) |
Get the IP address as a string. | |
const char * | getHostName (int ClientId) |
Gets the host name. | |
void | closeConnection (int ClientId) |
Close a connection. | |
void | closeAllConnections () |
Close all connections. | |
virtual CHMhl7ClientSocket & | onNewConnection (int ClientId) |
Called when there is a new connection This method is called when a new connection has been accepted. | |
virtual void | onError (int ErrorId, const char *ErrorMessage) |
called when an error occurs This method is called when an error occurs with the server socket such as not being able to listen on a port. | |
Friends | |
class | CHMhl7ClientSocket |
|
Constructor The default constructor creates a server object that's ready to listen. Call the listen() method to start listening. |
|
Destructor.
|
|
Close all connections. Closes all the connections that this server socket has accepted. |
|
Close a connection. Closes the connection specified by ClientId. If the connection has already been closed this function does nothing.
|
|
Gets the host name. This function does a lookup for the host name of the connection'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.
|
|
Makes server listen on a specified port Calling listen makes this socket start listening on the port specified. After this call is made, and there is no error, the socket is ready to receive incoming connecctions. When an incoming connnection is accepted the onNewConnection() event is called. If there is an error trying to listen the onError() event is called. Override these virtual methods on a base class to handle these events.
|
|
called when an error occurs This method is called when an error occurs with the server socket such as not being able to listen on a port. Errors that occur on a connection are not handled here but with the onTransportError() event. You can override this method on a base class to return your own derived implementation of CHMhl7ClientSocket.
|
|
Called when there is a new connection This method is called when a new connection has been accepted. The default behavior is to create a CHMhl7ClientSocket. You can override this method on a base class to return your own derived implementation of CHMhl7ClientSocket.
|
|
Send a message. Sends a message on the connection specified by ClientId. This call automatically wraps the message with the LLP header and footer.
|
|
Stops the server from listening Calling this method stops the socket from listening on the port specified in the call to listen(). Any incoming connection requests made after this method is called will fail. |