From f6fa26507f4f77d3691dd551e5af3040a6ccb911 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Tue, 10 Jul 2012 16:15:45 +0200 Subject: [PATCH] [Positioner] EvAAL: do not send \0 The NULL character must not be sent at the end of the result string, or the Socket Server behaves weirdly. --- owlps-positioner/src/outputtcpsocketevaal.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/owlps-positioner/src/outputtcpsocketevaal.cc b/owlps-positioner/src/outputtcpsocketevaal.cc index 956ecaa..8c2c4b1 100644 --- a/owlps-positioner/src/outputtcpsocketevaal.cc +++ b/owlps-positioner/src/outputtcpsocketevaal.cc @@ -135,7 +135,9 @@ area_of_interest_number(const Point3D &position) const */ bool OutputTCPSocketEvAAL::send_data(const string &data) const { - unsigned int data_len = data.size() + 1 ; // +1 for the '\0' + // Do *not* add one extra character for the '\0', it must not be sent! + unsigned int data_len = data.size() ; + ssize_t nsent = send(sockfd, data.c_str(), data_len, 0) ; if (nsent != static_cast(data_len)) {