X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/65bf2eef7ac487329a3af3cd1c06e7957afc3a6c..eb72ddd1b0a1004fa3da51db5b7790370cc5c2e9:/Server/src/transmitter.cpp diff --git a/Server/src/transmitter.cpp b/Server/src/transmitter.cpp index b8635fa..268f216 100644 --- a/Server/src/transmitter.cpp +++ b/Server/src/transmitter.cpp @@ -25,15 +25,41 @@ // $Id$ // -#include "transmitter.h" +#include "plaqui/server/transmitter.h" #include #include +#ifdef DEBUG +# include +#endif // DEBUG -using namespace Plaqui; +PlaQui::Server::Transmitter::~Transmitter(void) { +#ifdef DEBUG + std::cerr << __FILE__ << ": destructor." << std::endl; +#endif // DEBUG +} -Transmitter::Transmitter(std::string host, int port): - Connection(sockbuf::sock_dgram) { -#warning Not implemented! +/// \todo debría conectarse en real_run() (?) +PlaQui::Server::Transmitter::Transmitter(std::string host, int port): + PlaQui::Server::Connection(sockbuf::sock_dgram) { +#ifdef DEBUG + std::cerr << __FILE__ << ": host = " << host + << " | port = " << port << std::endl; +#endif // DEBUG + // FIXME - deberia ir en run(). socket->connect(host.c_str(), port); } +/// \todo debría dar una excepción (?) +void PlaQui::Server::Transmitter::real_run(void) { +#ifdef DEBUG + // FIXME - debería tirar una excepción? + if (!socket->is_open()) { + std::cerr << "No se pudo conectar a " << socket->peerhost() << + ":" << socket->peerport() << "." << std::endl; + } else { + std::cerr << "Conectado a " << socket->peerhost() << + ":" << socket->peerport() << "." << std::endl; + } +#endif // DEBUG +} +