#include "plaqui/server/transmitter.h"
#include <socket++/sockinet.h>
#include <string>
+#ifdef DEBUG
+# include <iostream>
+#endif // DEBUG
-using namespace PlaQui::Server;
+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) {
+/// \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);
}
-void Transmitter::real_run(void) {
+/// \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() <<
std::cerr << "Conectado a " << socket->peerhost() <<
":" << socket->peerport() << "." << std::endl;
}
+#endif // DEBUG
}