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