#include "serversocket.h" using namespace zutil; ServerSocket::ServerSocket( int port ){ if ( !SocketIO::create() ){ throw SocketException ( "Could not create server socket." ); } if ( !Socket::bind( port ) ){ throw SocketException ( "Could not bind to port." ); } if ( !Socket::listen() ){ throw SocketException ( "Could not listen to socket." ); } } Socket* ServerSocket::accept( ){ Socket *sock = new Socket(); accept(*sock); return sock; } void ServerSocket::accept( Socket& sock ){ if ( !SocketIO::accept( sock ) ){ throw SocketException ( "Could not accept socket." ); } }