summaryrefslogtreecommitdiff
path: root/i/simulotron/src/gs/gs_transmitter.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/simulotron/src/gs/gs_transmitter.cc')
-rw-r--r--i/simulotron/src/gs/gs_transmitter.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/i/simulotron/src/gs/gs_transmitter.cc b/i/simulotron/src/gs/gs_transmitter.cc
index e593cdb..9f53963 100644
--- a/i/simulotron/src/gs/gs_transmitter.cc
+++ b/i/simulotron/src/gs/gs_transmitter.cc
@@ -30,11 +30,16 @@
#include <sys/select.h>
#include <iostream>
-GSTransmitter::GSTransmitter(SocketClient & socket)
+GSTransmitter::GSTransmitter(SocketServer & socket)
:socket_(socket)
{
}
+GSTransmitter::GSTransmitter(const std::string & address, int port)
+{
+ socket_.connect(address, port);
+}
+
/// Renvoie 0 quand un message est récupéré, -1 sinon
int
GSTransmitter::getGS(GSMessage & gsm)
@@ -63,7 +68,7 @@ GSTransmitter::getGS(GSMessage & gsm)
| static_cast<int> (strBrut_[3]);
if(size > strBrut_.size() - 4)
return -1;
- gsm.writeGS (strBrut_.substr(4, size).data(), size);
+ gsm.appendGS (strBrut_.substr(4, size).data(), size);
strBrut_.erase (0, size + 4);
return 0;
}