From 4667d1d850a4a94d82ccc37d7573cd92225e0215 Mon Sep 17 00:00:00 2001 From: Mark Whitehorn Date: Sun, 1 Mar 2015 11:32:45 -0700 Subject: [PATCH] add diagnostic message for UDP datagram overflow --- src/comm/QGCXPlaneLink.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/comm/QGCXPlaneLink.cc b/src/comm/QGCXPlaneLink.cc index 42b7ad1d4..fa991fc30 100644 --- a/src/comm/QGCXPlaneLink.cc +++ b/src/comm/QGCXPlaneLink.cc @@ -553,8 +553,12 @@ void QGCXPlaneLink::readBytes() quint16 senderPort; unsigned int s = socket->pendingDatagramSize(); - if (s > maxLength) std::cerr << __FILE__ << __LINE__ << " UDP datagram overflow, allowed to read less bytes than datagram size" << std::endl; + if (s > maxLength) std::cerr << __FILE__ << __LINE__ << " UDP datagram overflow, allowed to read less bytes than datagram size: " << s << std::endl; socket->readDatagram(data, maxLength, &sender, &senderPort); + if (s > maxLength) { + std::string headStr = std::string(data, data+5); + std::cerr << __FILE__ << __LINE__ << " UDP datagram header: " << headStr << std::endl; + } // Calculate the number of data segments a 36 bytes // XPlane always has 5 bytes header: 'DATA@' -- 2.22.0