X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/65bf2eef7ac487329a3af3cd1c06e7957afc3a6c..1eadf77f99288a079f330d14feb6e81dac906cd3:/Server/src/server.cpp diff --git a/Server/src/server.cpp b/Server/src/server.cpp index bbf41c0..c0d0341 100644 --- a/Server/src/server.cpp +++ b/Server/src/server.cpp @@ -26,24 +26,40 @@ // #include "server.h" +#ifdef DEBUG +# include +#endif // DEBUG using namespace Plaqui; Server::Server(int port): socket(sockbuf::sock_stream) { -#warning Not implemented! - // TODO + socket.bind(port); +#ifdef DEBUG + std::cerr << "Escuchando en " << socket.localhost() << + ":" << socket.localport() << "." << std::endl; +#endif // DEBUG + socket.listen(); } bool Server::start_transmission(std::string host, int port) { -#warning Not implemented! // TODO return false; } bool Server::stop_transmission(std::string host, int port) { -#warning Not implemented! // TODO return false; } +void Server::real_run(void) { + // FIXME se tiene que ir a la clase para poder frenarlo desde afuera. + bool stop = false; + ControlServer* control_server; + while (!stop) { + control_server = new ControlServer(socket.accept()); + controllers.push_back(control_server); + control_server->run(); + } +} +