|
@@ -339,11 +339,20 @@ bool SSLServer::verbinde( unsigned short port, int warteschlangenLen )
|
|
|
addr.sin_port = htons( port );
|
|
|
s = socket( AF_INET, SOCK_STREAM, 0 );
|
|
|
if( s < 0 )
|
|
|
+ {
|
|
|
+ s = 0;
|
|
|
return 0;
|
|
|
+ }
|
|
|
if( bind( s, ( struct sockaddr* )&addr, sizeof( addr ) ) < 0 )
|
|
|
+ {
|
|
|
+ trenne();
|
|
|
return 0;
|
|
|
+ }
|
|
|
if( listen( s, warteschlangenLen ) < 0 )
|
|
|
+ {
|
|
|
+ trenne();
|
|
|
return 0;
|
|
|
+ }
|
|
|
return 1;
|
|
|
}
|
|
|
|
|
@@ -357,11 +366,18 @@ SSLSKlient *SSLServer::getKlient()
|
|
|
#ifdef WIN32
|
|
|
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
|
|
|
if( !client )
|
|
|
+ {
|
|
|
+ if( errno == ECONNABORTED || errno == EBADF )
|
|
|
+ trenne();
|
|
|
return 0;
|
|
|
+ }
|
|
|
#endif
|
|
|
addr.sin_port = this->addr.sin_port;
|
|
|
SSL *ssl = SSL_new( ctx );
|
|
@@ -403,6 +419,12 @@ unsigned short SSLServer::getPort() const
|
|
|
return htons( addr.sin_port );
|
|
|
}
|
|
|
|
|
|
+// giebt 1 zurück, falls der Server verbunden ist
|
|
|
+bool SSLServer::isConnected() const
|
|
|
+{
|
|
|
+ return s != 0;
|
|
|
+}
|
|
|
+
|
|
|
// Reference Counting
|
|
|
SSLServer *SSLServer::getThis()
|
|
|
{
|