|
|
@ -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); |
|
|
|
} |
|
|
|
} |
|
|
|