Server: #include "ServerSocket.h" #include "SocketException.h" #include #include int main ( int argc, int argv[] ) { std::cout << "running....\n"; int child[10]; int i; i = 0; try { // Create the socket ServerSocket server ( 30000 ); while ( true ) { ServerSocket new_sock; server.accept ( new_sock ); child[i] = fork(); if( child[i] == 0 ) { try { while ( true ) { new_sock << "te Verbindung"; sleep(5); } } catch ( SocketException& ) {} } else if(child[i] == -1) { //std::cout << "Fehler in Verbindung" << i << "\n"; } else { std::cout << i <<"te Verbindung aufgebaut\n"; i=i+1; } } } catch ( SocketException& e ) { std::cout << "Exception was caught:" << e.description() << "\nExiting.\n"; } return 0; } ------------------------- Client: #include "ClientSocket.h" #include "SocketException.h" #include #include int main ( int argc, int argv[] ) { try { ClientSocket client_socket ( "localhost", 30000 ); std::string reply; while(1) { try { client_socket >> reply; } catch ( SocketException& ) {} std::cout << reply << "\n";; } } catch ( SocketException& e ) { std::cout << "Exception was caught:" << e.description() << "\n"; } return 0; }