Hi, I am try to set up two small applications to test Juce's DatagramSockets. I would like to be able to send UDP messages from one Juce application to another.
I have create a sender that is set up with similar code to this:
pDatagramSocket = new DatagramSocket(localPortNumber, true); if (pDatagramSocket->connect(remoteHost, remotePortNumber)) { switch (pDatagramSocket->waitUntilReady(false, 3000)) { case 1: DBG("Socket ready"); break; case 0: DBG("Socket timed out"); break; case -1: DBG("Socket error"); break; } } else DBG("FAILED TO CONNECT");
I have also created a receiver with code something like this:
pDatagramSocket = new DatagramSocket(localPortNumber, true); if (pDatagramSocket->bindToPort(localPortNumber)) { switch (pDatagramSocket->waitUntilReady(true, 3000)) { case 1: DBG("Socket ready"); break; case 0: DBG("Socket timed out"); break; case -1: DBG("Socket error"); break; } } else DBG("FAILED TO CONNECT");
The issues that I am having is the receiver will not bind to a port. When if tries to bindToPort() if always seems to return false. I am not sure why this is. I tested the sender with a Python script and it seems to be working just fine.
Is there something I'm doing incorretly when setting up the receiver?