#include "receiver.h"
-/*
-Receiver::Receiver(int port, std::string host): Connection(sockbuf::dgram) {
+using namespace Plaqui;
+
+Receiver::Receiver(int port, std::string host):
+ Connection(sockbuf::sock_dgram) {
+ // FIXME - deberia ir en run().
socket->bind(port);
}
-*/
+
+void Receiver::run(void) {
+ // 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;
+ }
+}