Reading response from UDP using R4x

Hey all,

I have a SARA board and can successfully use the UDP client example based on the R4x libs.
However I’d like to read the response from the server to verify data has been received by the server but struggling to get this working.
Based on a different post on the forum I came up with something like the code below but it doesn’t wait for nor print any messages from the server.
Is it possible with the R4x lib or do I need a different approach?

if (r4x.socketWaitForReceive(socketID)) {
while (r4x.socketHasPendingBytes(socketID)) {
DEBUG_STREAM.println(“I have pending bytes”);
char data[200];
while (r4x.socketReceive(socketID, (uint8_t*)data, 200)) {
DEBUG_STREAM.println(“I’m reading bytes”);

The default timeout is 15 seconds, you can increase this value if this is needed.

bool Sodaq_R4X::socketWaitForReceive(uint8_t socketID, uint32_t timeout)

How do you send data back to the device?
You need to create a UDP response, not new socket to send data to the device then it will be blocked by the firewall.

Hope this helps you find the issue.

Best regards,