瀏覽代碼

enabled setting timouts on connections to clients on serverside

Kolja Strohm 2 年之前
父節點
當前提交
3b33c89bb5
共有 2 個文件被更改,包括 143 次插入83 次删除
  1. 89 35
      Network/Server.cpp
  2. 54 48
      Network/Server.h

+ 89 - 35
Network/Server.cpp

@@ -33,7 +33,7 @@ bool Server::verbinde( unsigned short port, int warteschlangenLen ) // 
 {
     sock = socket( AF_INET, SOCK_STREAM, 0 ); // Socket erstellen
     addresse.sin_port = htons( port ); // port setzen
-    if( bind( sock, (struct sockaddr *)&addresse, sizeof( addresse ) ) == -1 ) // socket öffnen
+    if( bind( sock, (struct sockaddr*)&addresse, sizeof( addresse ) ) == -1 ) // socket öffnen
     {
         trenne();
         return 0; // Fehler
@@ -46,21 +46,21 @@ bool Server::verbinde( unsigned short port, int warteschlangenLen ) // 
     return 1;
 }
 
-SKlient *Server::getKlient() // nimmt Klient an
+SKlient* Server::getKlient() // nimmt Klient an
 {
     if( !sock )
         return 0;
     sockaddr_in client;
     int len = sizeof( addresse );
 #ifdef WIN32
-    SOCKET cls = accept( sock, (sockaddr *)&client, &len ); // Klient empfangen
+    SOCKET cls = accept( sock, (sockaddr*)&client, &len ); // Klient empfangen
     if( cls == INVALID_SOCKET )
     {
         trenne();
         return 0;
     }
 #else
-    SOCKET cls = accept( sock, (sockaddr *)&client, (socklen_t *)&len ); // Klient empfangen
+    SOCKET cls = accept( sock, (sockaddr*)&client, (socklen_t*)&len ); // Klient empfangen
     if( !cls )
     {
         if( errno == ECONNABORTED || errno == EBADF )
@@ -113,6 +113,7 @@ SKlient::SKlient( sockaddr_in addresse, SOCKET sock )
     upStreamBytes = 0;
     sendeKey = 0;
     empfangKey = 0;
+    empfangTimeout = 0;
 }
 
 // Destruktor 
@@ -126,35 +127,52 @@ SKlient::~SKlient()
 }
 
 // nicht constant 
-void SKlient::setSendeKeyZ( Encryption::Key *key ) // Setzt den Key fürs Senden
+void SKlient::setEmpfangTimeout( int miliseconds ) // Setzt ein timeout fürs empfangen von daten
+{
+    empfangTimeout = miliseconds;
+    if( empfangTimeout )
+    {
+#ifdef WIN32
+        DWORD timeout = miliseconds;
+        setsockopt( sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof timeout );
+#else
+        struct timeval tv;
+        tv.tv_sec = miliseconds / 1000;
+        tv.tv_usec = (miliseconds % 1000) * 1000;
+        setsockopt( sock, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv );
+#endif
+    }
+}
+
+void SKlient::setSendeKeyZ( Encryption::Key* key ) // Setzt den Key fürs Senden
 {
     if( sendeKey )
         sendeKey->release();
     sendeKey = key;
 }
 
-void SKlient::setEmpfangKeyZ( Encryption::Key *key ) // Setzt den Key fürs Empfangen
+void SKlient::setEmpfangKeyZ( Encryption::Key* key ) // Setzt den Key fürs Empfangen
 {
     if( empfangKey )
         empfangKey->release();
     empfangKey = key;
 }
 
-void SKlient::setSendeKey( char *key, int len ) // Setzt den Key fürs Senden
+void SKlient::setSendeKey( char* key, int len ) // Setzt den Key fürs Senden
 {
     if( !sendeKey )
         sendeKey = new Encryption::Key();
     sendeKey->setKey( key, len );
 }
 
-void SKlient::setEmpfangKey( char *key, int len ) // Setzt den Key fürs Empfangen
+void SKlient::setEmpfangKey( char* key, int len ) // Setzt den Key fürs Empfangen
 {
     if( !empfangKey )
         empfangKey = new Encryption::Key();
     empfangKey->setKey( key, len );
 }
 
-bool SKlient::sende( const char *nachricht, int len ) // sendet zum Klient
+bool SKlient::sende( const char* nachricht, int len ) // sendet zum Klient
 {
     if( !sock )
         return 0;
@@ -175,14 +193,14 @@ bool SKlient::sende( const char *nachricht, int len ) // sendet zum Klient
     return 1;
 }
 
-bool SKlient::getNachricht( char *nachricht, int len ) // empfängt Nachricht von Klient
+bool SKlient::getNachricht( char* nachricht, int len ) // empfängt Nachricht von Klient
 {
     if( !sock )
         return 0;
     int ll = 0;
     while( len > 0 )
     {
-        int l = (int)recv( sock, nachricht + ll, len, MSG_WAITALL );
+        int l = (int)recv( sock, nachricht + ll, len, empfangTimeout ? 0 : MSG_WAITALL );
         if( l <= 0 )
             return 0; // Fehler
         len -= l;
@@ -192,12 +210,12 @@ bool SKlient::getNachricht( char *nachricht, int len ) // empf
     return 1;
 }
 
-bool SKlient::sendeEncrypted( const char *nachricht, int len ) // sendet zum Server
+bool SKlient::sendeEncrypted( const char* nachricht, int len ) // sendet zum Server
 {
     if( !sendeKey )
         return sende( nachricht, len );
-    Encryption::Bytes *n = new Encryption::Bytes( nachricht, len );
-    sendeKey->codieren( dynamic_cast<Encryption::Bytes *>( n->getThis() ) ); int ll = 0;
+    Encryption::Bytes* n = new Encryption::Bytes( nachricht, len );
+    sendeKey->codieren( dynamic_cast<Encryption::Bytes*>(n->getThis()) ); int ll = 0;
     while( len > 0 )
     {
 #ifdef WIN32
@@ -218,20 +236,20 @@ bool SKlient::sendeEncrypted( const char *nachricht, int len ) // sendet zum Ser
     return 1;
 }
 
-bool SKlient::getNachrichtEncrypted( char *nachricht, int len ) // empfängt Nachricht
+bool SKlient::getNachrichtEncrypted( char* nachricht, int len ) // empfängt Nachricht
 {
     if( !empfangKey )
         return getNachricht( nachricht, len );
     int ll = 0;
     while( len > 0 )
     {
-        int l = (int)recv( sock, nachricht + ll, len, MSG_WAITALL );
+        int l = (int)recv( sock, nachricht + ll, len, empfangTimeout ? 0 : MSG_WAITALL );
         if( l <= 0 )
             return 0; // Fehler
         len -= l;
         ll += l;
     }
-    Encryption::Bytes *n = new Encryption::Bytes();
+    Encryption::Bytes* n = new Encryption::Bytes();
     n->setBytesZ( nachricht, ll );
     empfangKey->decodieren( n );
     downStreamBytes += ll;
@@ -265,24 +283,33 @@ bool SKlient::trenne() // trennt die Verbindung zum Klient
 }
 
 // constant 
+bool SKlient::hatNachricht( int zeit ) const // Wartet eine Zeit Lang auf eine Nachricht
+{
+    fd_set set;
+    FD_ZERO( &set );
+    FD_SET( sock, &set );
+    timeval time = { zeit / 1000, zeit };
+    return select( 0, &set, 0, 0, &time ) == 1;
+}
+
 unsigned short SKlient::getPort() const // gibt den Port zurück
 {
     return htons( clientAddr.sin_port );
 }
 
-const char *SKlient::getIp() const // gibt die Ip des Klients zurück
+const char* SKlient::getIp() const // gibt die Ip des Klients zurück
 {
     return inet_ntoa( clientAddr.sin_addr );
 }
 
-int pem_passwd_cb( char *buf, int size, int rwflag, void *userdata )
+int pem_passwd_cb( char* buf, int size, int rwflag, void* userdata )
 {
-    const char *passw = ( (Text *)userdata )->getText();
+    const char* passw = ((Text*)userdata)->getText();
     memcpy( buf, passw, MIN( (unsigned int)size, strlen( passw ) + 1 ) );
     return (int)strlen( buf );
 }
 
-bool SSLErrorCheck( int result, SSL *ssl, const char *action )
+bool SSLErrorCheck( int result, SSL* ssl, const char* action )
 {
     if( result <= 0 )
     {
@@ -293,7 +320,7 @@ bool SSLErrorCheck( int result, SSL *ssl, const char *action )
     return 1;
 }
 
-bool SSLErrorCheck( int result, const char *action )
+bool SSLErrorCheck( int result, const char* action )
 {
     if( result <= 0 )
     {
@@ -311,7 +338,7 @@ SSLServer::SSLServer()
     : ReferenceCounter()
 {
     s = 0;
-    const SSL_METHOD *method = TLS_server_method();
+    const SSL_METHOD* method = TLS_server_method();
     ctx = SSL_CTX_new( method );
     SSLErrorCheck( SSL_CTX_set_min_proto_version( ctx, TLS1_2_VERSION ), "SSL_CTX_set_min_proto_version" );
     SSLErrorCheck( SSL_CTX_set_max_proto_version( ctx, TLS1_3_VERSION ), "SSL_CTX_set_max_proto_version" );
@@ -337,19 +364,19 @@ SSLServer::~SSLServer()
 
 // nicht constant 
 // Setzt den Pfad zur Datei, in dem das Certifikat gespeichert ist
-bool SSLServer::setCertificateFile( const char *file )
+bool SSLServer::setCertificateFile( const char* file )
 {
     return SSLErrorCheck( SSL_CTX_use_certificate_file( ctx, file, SSL_FILETYPE_PEM ), "SSL_CTX_use_certificate_file" );
 }
 
 // Setzt den Pfad zur Datei, in dem der private Schlüssel gespeichert ist
-bool SSLServer::setPrivateKeyFile( const char *file )
+bool SSLServer::setPrivateKeyFile( const char* file )
 {
     return SSLErrorCheck( SSL_CTX_use_PrivateKey_file( ctx, file, SSL_FILETYPE_PEM ), "SSL_CTX_use_PrivateKey_file" );
 }
 
 // setzt das passwort des private keys (muss vor setPrivateKeyFile aufgerufen werden)
-void SSLServer::setPrivateKeyPassword( const char *password )
+void SSLServer::setPrivateKeyPassword( const char* password )
 {
     passw->setText( password );
 }
@@ -364,7 +391,7 @@ bool SSLServer::verbinde( unsigned short port, int warteschlangenLen )
         s = 0;
         return 0;
     }
-    if( bind( s, (struct sockaddr *)&addr, sizeof( addr ) ) < 0 )
+    if( bind( s, (struct sockaddr*)&addr, sizeof( addr ) ) < 0 )
     {
         trenne();
         return 0;
@@ -378,21 +405,21 @@ bool SSLServer::verbinde( unsigned short port, int warteschlangenLen )
 }
 
 // nimmt Klient an
-SSLSKlient *SSLServer::getKlient()
+SSLSKlient* SSLServer::getKlient()
 {
     if( !s )
         return 0;
     int len = sizeof( addr );
     struct sockaddr_in addr;
 #ifdef WIN32
-    SOCKET client = accept( s, (struct sockaddr *)&addr, &len );
+    SOCKET client = accept( s, (struct sockaddr*)&addr, &len );
     if( client == INVALID_SOCKET )
     {
         trenne();
         return 0;
     }
 #else
-    SOCKET client = accept( s, (sockaddr *)&addr, (socklen_t *)&len ); // Klient empfangen
+    SOCKET client = accept( s, (sockaddr*)&addr, (socklen_t*)&len ); // Klient empfangen
     if( !client )
     {
         if( errno == ECONNABORTED || errno == EBADF )
@@ -401,7 +428,7 @@ SSLSKlient *SSLServer::getKlient()
     }
 #endif
     addr.sin_port = this->addr.sin_port;
-    SSL *ssl = SSL_new( ctx );
+    SSL* ssl = SSL_new( ctx );
     if( ssl == 0 && !SSLErrorCheck( 0, "SSL_new" ) )
     {
         closesocket( client );
@@ -459,7 +486,7 @@ bool SSLServer::isConnected() const
 
 // Inhalt der SSLSKlient Klasse
 // Konstruktor 
-SSLSKlient::SSLSKlient( sockaddr_in client, SSL *ssl, SOCKET s )
+SSLSKlient::SSLSKlient( sockaddr_in client, SSL* ssl, SOCKET s )
     : ReferenceCounter()
 {
     this->s = s;
@@ -467,6 +494,7 @@ SSLSKlient::SSLSKlient( sockaddr_in client, SSL *ssl, SOCKET s )
     this->ssl = ssl;
     downStreamBytes = 0;
     upStreamBytes = 0;
+    empfangTimeout = 0;
 }
 
 // Destruktor 
@@ -479,7 +507,24 @@ SSLSKlient::~SSLSKlient()
 }
 
 // nicht constant 
-bool SSLSKlient::sende( const char *nachricht, int len ) // sendet zum Klient
+void SSLSKlient::setEmpfangTimeout( int miliseconds ) // Setzt ein timeout fürs empfangen von daten
+{
+    empfangTimeout = miliseconds;
+    if( empfangTimeout )
+    {
+#ifdef WIN32
+        DWORD timeout = miliseconds;
+        setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, (const char*)&timeout, sizeof timeout );
+#else
+        struct timeval tv;
+        tv.tv_sec = miliseconds / 1000;
+        tv.tv_usec = (miliseconds % 1000) * 1000;
+        setsockopt( s, SOL_SOCKET, SO_RCVTIMEO, (const char*)&tv, sizeof tv );
+#endif
+    }
+}
+
+bool SSLSKlient::sende( const char* nachricht, int len ) // sendet zum Klient
 {
     if( !ssl )
         return 0;
@@ -496,7 +541,7 @@ bool SSLSKlient::sende( const char *nachricht, int len ) // sendet zum Klient
     return 1;
 }
 
-bool SSLSKlient::getNachricht( char *nachricht, int len ) // empfängt Nachricht von Klient
+bool SSLSKlient::getNachricht( char* nachricht, int len ) // empfängt Nachricht von Klient
 {
     if( !ssl )
         return 0;
@@ -542,12 +587,21 @@ bool SSLSKlient::trenne() // trennt die Verbindung zum Klient
 }
 
 // constant 
+bool SSLSKlient::hatNachricht( int zeit ) const // Wartet eine Zeit Lang auf eine Nachricht
+{
+    fd_set set;
+    FD_ZERO( &set );
+    FD_SET( SSL_get_rfd( ssl ), &set );
+    timeval time = { zeit / 1000, zeit };
+    return SSL_pending( ssl ) > 0 || select( 0, &set, 0, 0, &time ) == 1;
+}
+
 unsigned short SSLSKlient::getPort() const // gibt den Port zurück
 {
     return htons( clientAddr.sin_port );
 }
 
-const char *SSLSKlient::getIp() const // gibt die Ip des Klients zurück
+const char* SSLSKlient::getIp() const // gibt die Ip des Klients zurück
 {
     return inet_ntoa( clientAddr.sin_addr );
 }

+ 54 - 48
Network/Server.h

@@ -34,17 +34,17 @@ namespace Network
 
     public:
         // Konstruktor 
-        __declspec( dllexport ) Server();
+        __declspec(dllexport) Server();
         // Destruktor 
-        __declspec( dllexport ) ~Server();
+        __declspec(dllexport) ~Server();
         // nicht constant 
-        __declspec( dllexport ) bool verbinde( unsigned short port, int warteschlangenLen ); // Öffnet das Socket
-        __declspec( dllexport ) SKlient *getKlient(); // nimmt Klient an
-        __declspec( dllexport ) int getKlients( bool reset ); // gibt die Anzahl der Klients zurück
-        __declspec( dllexport ) bool trenne(); // beendet den Server
+        __declspec(dllexport) bool verbinde( unsigned short port, int warteschlangenLen ); // Öffnet das Socket
+        __declspec(dllexport) SKlient* getKlient(); // nimmt Klient an
+        __declspec(dllexport) int getKlients( bool reset ); // gibt die Anzahl der Klients zurück
+        __declspec(dllexport) bool trenne(); // beendet den Server
         // constant
-        __declspec( dllexport ) unsigned short getPort() const; // gibt den Port zurück
-        __declspec( dllexport ) bool isConnected() const; // giebt 1 zurück, falls der Server verbunden ist
+        __declspec(dllexport) unsigned short getPort() const; // gibt den Port zurück
+        __declspec(dllexport) bool isConnected() const; // giebt 1 zurück, falls der Server verbunden ist
     };
 
     class SKlient : public EncryptedVerbindung, public virtual ReferenceCounter
@@ -52,31 +52,34 @@ namespace Network
     private:
         SOCKET sock;
         sockaddr_in clientAddr;
-        Encryption::Key *sendeKey;
-        Encryption::Key *empfangKey;
+        Encryption::Key* sendeKey;
+        Encryption::Key* empfangKey;
         int downStreamBytes;
         int upStreamBytes;
+        int empfangTimeout;
 
     public:
         // Konstruktor 
-        __declspec( dllexport ) SKlient( sockaddr_in client, SOCKET sock );
+        __declspec(dllexport) SKlient( sockaddr_in client, SOCKET sock );
         // Destruktor 
-        __declspec( dllexport ) ~SKlient();
+        __declspec(dllexport) ~SKlient();
         // nicht constant 
-        __declspec( dllexport ) void setSendeKeyZ( Encryption::Key *key ); // Setzt den Schlüssel fürs Senden
-        __declspec( dllexport ) void setEmpfangKeyZ( Encryption::Key *key ); // Setzt den Schlüssel fürs Empfangen
-        __declspec( dllexport ) void setSendeKey( char *key, int len ); // Setzt den Schlüssel fürs Senden
-        __declspec( dllexport ) void setEmpfangKey( char *key, int len ); // Setzt den Schlüssel fürs Empfangen
-        __declspec( dllexport ) bool sende( const char *nachricht, int len ) override; // sendet zum Klient
-        __declspec( dllexport ) bool getNachricht( char *nachricht, int len ) override; // empfängt Nachricht von Klient
-        __declspec( dllexport ) bool sendeEncrypted( const char *nachricht, int len ) override; // sendet zum Server
-        __declspec( dllexport ) bool getNachrichtEncrypted( char *nachricht, int len ) override; // empfängt Nachricht
-        __declspec( dllexport ) int getDownloadBytes( bool reset ); // gibt die anzahl von empfangen bytes zurück
-        __declspec( dllexport ) int getUploadBytes( bool reset ); // gibt die anzahl von versendeter bytes zurück
-        __declspec( dllexport ) bool trenne(); // trennt die Verbindung zum Klient
+        __declspec(dllexport) void setEmpfangTimeout( int miliseconds ); // Setzt ein timeout fürs empfangen von daten
+        __declspec(dllexport) void setSendeKeyZ( Encryption::Key* key ); // Setzt den Schlüssel fürs Senden
+        __declspec(dllexport) void setEmpfangKeyZ( Encryption::Key* key ); // Setzt den Schlüssel fürs Empfangen
+        __declspec(dllexport) void setSendeKey( char* key, int len ); // Setzt den Schlüssel fürs Senden
+        __declspec(dllexport) void setEmpfangKey( char* key, int len ); // Setzt den Schlüssel fürs Empfangen
+        __declspec(dllexport) bool sende( const char* nachricht, int len ) override; // sendet zum Klient
+        __declspec(dllexport) bool getNachricht( char* nachricht, int len ) override; // empfängt Nachricht von Klient
+        __declspec(dllexport) bool sendeEncrypted( const char* nachricht, int len ) override; // sendet zum Server
+        __declspec(dllexport) bool getNachrichtEncrypted( char* nachricht, int len ) override; // empfängt Nachricht
+        __declspec(dllexport) int getDownloadBytes( bool reset ); // gibt die anzahl von empfangen bytes zurück
+        __declspec(dllexport) int getUploadBytes( bool reset ); // gibt die anzahl von versendeter bytes zurück
+        __declspec(dllexport) bool trenne(); // trennt die Verbindung zum Klient
         // constant 
-        __declspec( dllexport ) unsigned short getPort() const; // gibt den Port zurück
-        __declspec( dllexport ) const char *getIp() const; // gibt die Ip des Klients zurück
+        __declspec(dllexport) bool hatNachricht( int zeit ) const; // Wartet eine Zeit Lang auf eine Nachricht
+        __declspec(dllexport) unsigned short getPort() const; // gibt den Port zurück
+        __declspec(dllexport) const char* getIp() const; // gibt die Ip des Klients zurück
     };
 
     class SSLSKlient;
@@ -86,60 +89,63 @@ namespace Network
     private:
         SOCKET s;
         SOCKADDR_IN addr;
-        SSL_CTX *ctx;
-        Text *passw;
+        SSL_CTX* ctx;
+        Text* passw;
         int klients;
 
     public:
         // Konstruktor 
-        __declspec( dllexport ) SSLServer();
+        __declspec(dllexport) SSLServer();
         // Destruktor 
-        __declspec( dllexport ) ~SSLServer();
+        __declspec(dllexport) ~SSLServer();
         // nicht constant 
         // Setzt den Pfad zur Datei, in dem das Certifikat gespeichert ist
-        __declspec( dllexport ) bool setCertificateFile( const char *file );
+        __declspec(dllexport) bool setCertificateFile( const char* file );
         // Setzt den Pfad zur Datei, in dem der private Schlüssel gespeichert ist
-        __declspec( dllexport ) bool setPrivateKeyFile( const char *file );
+        __declspec(dllexport) bool setPrivateKeyFile( const char* file );
         // setzt das passwort des private keys (muss vor setPrivateKeyFile aufgerufen werden)
-        __declspec( dllexport ) void setPrivateKeyPassword( const char *password );
+        __declspec(dllexport) void setPrivateKeyPassword( const char* password );
         // Öffnet das Socket
-        __declspec( dllexport ) bool verbinde( unsigned short port, int warteschlangenLen );
+        __declspec(dllexport) bool verbinde( unsigned short port, int warteschlangenLen );
         // nimmt Klient an
-        __declspec( dllexport ) SSLSKlient *getKlient();
+        __declspec(dllexport) SSLSKlient* getKlient();
         // gibt die Anzahl der Klients zurück
-        __declspec( dllexport ) int getKlients( bool reset );
+        __declspec(dllexport) int getKlients( bool reset );
         // beendet den Server
-        __declspec( dllexport ) bool trenne();
+        __declspec(dllexport) bool trenne();
         // constant
         // gibt den Port zurück
-        __declspec( dllexport ) unsigned short getPort() const;
+        __declspec(dllexport) unsigned short getPort() const;
         // giebt 1 zurück, falls der Server verbunden ist
-        __declspec( dllexport ) bool isConnected() const;
+        __declspec(dllexport) bool isConnected() const;
     };
 
     class SSLSKlient : public Verbindung, public virtual ReferenceCounter
     {
     private:
         SOCKET s;
-        SSL *ssl;
+        SSL* ssl;
         sockaddr_in clientAddr;
         int downStreamBytes;
         int upStreamBytes;
+        int empfangTimeout;
 
     public:
         // Konstruktor 
-        __declspec( dllexport ) SSLSKlient( sockaddr_in client, SSL *ssl, SOCKET s );
+        __declspec(dllexport) SSLSKlient( sockaddr_in client, SSL* ssl, SOCKET s );
         // Destruktor 
-        __declspec( dllexport ) ~SSLSKlient();
+        __declspec(dllexport) ~SSLSKlient();
         // nicht constant 
-        __declspec( dllexport ) bool sende( const char *nachricht, int len ) override; // sendet zum Klient
-        __declspec( dllexport ) bool getNachricht( char *nachricht, int len ) override; // empfängt Nachricht von Klient
-        __declspec( dllexport ) int getDownloadBytes( bool reset ); // gibt die anzahl von empfangen bytes zurück
-        __declspec( dllexport ) int getUploadBytes( bool reset ); // gibt die anzahl von versendeter bytes zurück
-        __declspec( dllexport ) bool trenne(); // trennt die Verbindung zum Klient
+        __declspec(dllexport) void setEmpfangTimeout( int miliseconds ); // Setzt ein timeout fürs empfangen von daten
+        __declspec(dllexport) bool sende( const char* nachricht, int len ) override; // sendet zum Klient
+        __declspec(dllexport) bool getNachricht( char* nachricht, int len ) override; // empfängt Nachricht von Klient
+        __declspec(dllexport) int getDownloadBytes( bool reset ); // gibt die anzahl von empfangen bytes zurück
+        __declspec(dllexport) int getUploadBytes( bool reset ); // gibt die anzahl von versendeter bytes zurück
+        __declspec(dllexport) bool trenne(); // trennt die Verbindung zum Klient
         // constant 
-        __declspec( dllexport ) unsigned short getPort() const; // gibt den Port zurück
-        __declspec( dllexport ) const char *getIp() const; // gibt die Ip des Klients zurück
+        __declspec(dllexport) bool hatNachricht( int zeit ) const; // Wartet eine Zeit Lang auf eine Nachricht
+        __declspec(dllexport) unsigned short getPort() const; // gibt den Port zurück
+        __declspec(dllexport) const char* getIp() const; // gibt die Ip des Klients zurück
     };
 }