[UDP Library] Can you tell if 'udp.send' is successful?

'import hypermedia.net.*; ’ library

import hypermedia.net.*;
UDP udp;  

void setup() {

  size(300,300);
  udp = new UDP( this, 12001 );
  udp.listen( true );
  
  String message  = "test"; 
  String ip       = "92.168.0.189";  
  int port        = 11999;    
  udp.send( message, ip, port );  // Did you succeed? failed?

}

Can you tell if ‘udp.send’ is successful?

‘udp.send()’ comes in boolean form. Even if I turn off the internet and work ‘udp.send()’, only ‘true’ value is displayed.

  1. Is there a way to check if the Internet is live in real time?
  2. Or is ‘udp.send()’ successful? is it a failure? Can you judge?

You will find your answer in USE Datagram Protocol (Wikipedia) section Reliability and congestion control.

So in case you need some reliability, add a simple checksum computation to your data, in case checksum is incorrect reject the data. There are many other ideas to solve this issue.

1 Like