X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/65bf2eef7ac487329a3af3cd1c06e7957afc3a6c..6e0194f46ac77c18bfeabf84ef94a32f23e41073:/Server/src/server.cpp diff --git a/Server/src/server.cpp b/Server/src/server.cpp index bbf41c0..6507d6d 100644 --- a/Server/src/server.cpp +++ b/Server/src/server.cpp @@ -25,25 +25,41 @@ // $Id$ // -#include "server.h" +#include "plaqui/server/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(); + } +} +