Commit 19647652 authored by lm's avatar lm

Improved debug output

parent a7383a1a
...@@ -140,20 +140,21 @@ void UDPLink::removeHost(const QString& hostname) ...@@ -140,20 +140,21 @@ void UDPLink::removeHost(const QString& hostname)
void UDPLink::writeBytes(const char* data, qint64 size) void UDPLink::writeBytes(const char* data, qint64 size)
{ {
// Broadcast to all connected systems // Broadcast to all connected systems
//QList<QHostAddress>::iterator h; for (int h = 0; h < hosts.size(); h++)
// for (h = hosts->begin(); h != hosts->end(); ++h) {
for (int h = 0; h < hosts.size(); h++) {
QHostAddress currentHost = hosts.at(h); QHostAddress currentHost = hosts.at(h);
quint16 currentPort = ports.at(h); quint16 currentPort = ports.at(h);
QString bytes;
qDebug() << "WRITING TO" << currentHost.toIPv4Address() << currentPort; QString ascii;
//qDebug() << "WRITING DATA TO" << currentHost.toString() << currentPort;
for (int i=0; i<size; i++) { for (int i=0; i<size; i++) {
unsigned char v =data[i]; unsigned char v = data[i];
qDebug("%02x ", v); bytes.append(QString().sprintf("%02x ", v));
ascii.append(data[i]);
} }
qDebug() <<"Sent to " << currentHost.toString() << ":" << currentPort; qDebug() << "Sent" << size << "bytes to" << currentHost.toString() << ":" << currentPort << "data:";
qDebug() << bytes;
qDebug() << "ASCII:" << ascii;
socket->writeDatagram(data, size, currentHost, currentPort); socket->writeDatagram(data, size, currentHost, currentPort);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment