// $Id$
//
-#include "server.h"
+#include "plaqui/server/server.h"
+#ifdef DEBUG
+# include <iostream>
+#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();
+ }
+}
+