Class Hierarchy   Class Index   Method Index  

CHMhl7ServerSocket.h

00001 #ifndef __CHM_HL7_SERVER_SOCKET_H__
00002 #define __CHM_HL7_SERVER_SOCKET_H__
00003 
00004 #include <CHM/CHMminimumInclude.h>
00005 #include <CHM/CHMhl7ClientSocket.h>
00006 
00007 struct CHMhl7ServerSocketPrivate;
00008 
00015 void CHMnetStop();
00016 
00017 // CHMnetWait is not required anymore since CHMnetStop() will block until the networking
00018 // thread stops so this function has been removed.
00019 //void CHMnetWait();
00020 
00033 class CHMhl7ServerSocket : public CHMconnectionEvents
00034 {
00035 public:
00040    CHMhl7ServerSocket();
00041 
00043    virtual ~CHMhl7ServerSocket();
00044 
00053    void listen( short Port );
00054 
00059    void stopListening();
00060 
00068    void sendMessage( int ClientId, const char* Message );
00069 
00075    CHMuint32 getIpAddress( int ClientId );
00076 
00082    const char* getIpAddressString( int ClientId );
00083 
00091    const char* getHostName( int ClientId );
00092 
00099    void closeConnection( int ClientId );
00100 
00104    void closeAllConnections();
00105 
00115    virtual CHMhl7ClientSocket& onNewConnection( int ClientId );
00116 
00124    virtual void onError( int ErrorId, const char* ErrorMessage ){}
00125 
00126 private:
00127    friend class CHMhl7ClientSocket;
00128    static void ensureInitialized();
00129 
00130    CHMhl7ServerSocketPrivate* pMember;
00131    
00132    // not allowed
00133    CHMhl7ServerSocket(const CHMhl7ServerSocket& Orig);
00134    CHMhl7ServerSocket& operator=(const CHMhl7ServerSocket& Orig);
00135 };
00136 
00137 #endif // end of defensive include