Question

I'm building a computer client that receives data from a medical patient monitor over UDP IP. I'm using QTs API and hence the QUdpSocket class to establish the communication. The monitor I want to recieve data from is dependent on a BootP server to receive and IP address. This is succesfully acheived, and the IP I have given it is "192.168.10.10". By using the Microsoft Network Monitor I can see that packets I want to read from my program are sent from - Source: 192.168.10.10 to - Destination: 192.168.10.255. Both source and destination port is: 24005.

The code I use to establish the communication and reading datagrams is as follows:

connectIndicationPort=24005;
connectIndicationAddress=QHostAddress("192.168.10.255");
connectIndicationSocket = new QUdpSocket;

int test = connectIndicationSocket->bind(connectIndicationAddress, connectIndicationPort);
if(test)
{
qDebug() << "Connection to port "<< connectIndicationPort <<", at" << connectIndicationAddress  << "succeeded.";
    bool res = connect(connectIndicationSocket, SIGNAL(readyRead()), this, SLOT(readConnectIndicationDatagram()));
}
else
    qDebug() << "Connection to port "<< connectIndicationPort <<", at" << connectIndicationAddress  << "failed.";

I have also tried different variants of the bind() command as:

connectIndicationSocket->bind(connectIndicationPort);

connectIndicationSocket->bind(connectIndicationPort, QUdpSocket::ShareAddress)

connectIndicationSocket->bind(QHostAddress::Broadcast, connectIndicationPort)

without any luck.

I have little experience from IP networking, and I don't know where this fails. Is it for example right to bind the socket to the destination address or should it be the source address? (I have tried both). And is the assigned IP address valid? And what other sources of errors could it might be? I guess that the packets are not blocked by my firewall as they are visible in the network monitor.

Would really appreciate input on this :)

Best, Morten

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top