Hello, i have a problem using the hypermedia.net library, i can’t send bytes, when i try i get error message: “The function” send () "expects parameters like: “send (String, String, int)” ".
While normally it is possible to send some.
I specify that I start on processing.
If anyone has an answer.
Hello,
Take a look at the UDP examples.
I created two sketches to talk to each other on the localhost.
I modified this to send the ASCII table as a byte array:
/**
* on key pressed event:
* send the current key value over the network
*/
void keyPressed()
{
//String message = ""; // the message to send
byte [] data = new byte [256];
for (int i = 0; i< 256; i++)
{
data[i] = byte(i);
}
String message = new String(data);
String ip = "192.168.1.100"; // the remote IP address
int port = 9000; // the destination port
// formats the message for Pd
message = message+";\n";
// send the message
udp.send( message, ip, port );
}
And voila!
I also printed the received message size and it is 256 as expected.
See also an example (complicated or simple depending on user experience):
That is as far as I explored the UDP library.
I worked with the existing examples at first and did a search after for:
References:
Convert a byte array to a String in Java | Techie Delight
:)
1 Like