11#include " oscudpsocket.h"
22
3- OscUdpSocket::OscUdpSocket (QObject *parent) : QObject(parent), sendQueue(new QQueue<QByteArray*>()), sendTimer(new QTimer())
3+ OscUdpSocket::OscUdpSocket (QObject *parent) : QObject(parent), sendQueue(new QQueue<QByteArray*>()), sendTimer(new QTimer()), hostAddr(QString())
44{
55
66}
@@ -18,6 +18,18 @@ void OscUdpSocket::initSocket()
1818
1919 connect (udpSocket, SIGNAL (readyRead ()), this , SLOT (readPendingDatagrams ()));
2020 connect (sendTimer, SIGNAL (timeout ()), this , SLOT (processSendQueue ()));
21+
22+ if (this ->hostAddr == " " ) {
23+ this ->hostAddr = " 172.16.1.100" ;
24+
25+ QString envHost = QString (qgetenv (" X32HOST" ));
26+ if (envHost != " " ) {
27+ qDebug () << " Using envvar X32HOST for target address" ;
28+ this ->hostAddr = envHost;
29+ }
30+
31+ qDebug () << " Setting connection Address to: " << this ->hostAddr ;
32+ }
2133}
2234
2335// useless !
@@ -57,7 +69,7 @@ void OscUdpSocket::processSendQueue()
5769
5870 assert (this ->udpSocket != nullptr );
5971
60- qint64 bytesWritten = this ->udpSocket ->writeDatagram (*data, QHostAddress (" 172.16.1.100 " ), 10023 );
72+ qint64 bytesWritten = this ->udpSocket ->writeDatagram (*data, QHostAddress (this -> hostAddr ), 10023 );
6173
6274 // qint64 bytesWritten = udpSocket->write(*data);
6375 if (bytesWritten < 0 ) {
0 commit comments