1

I'm writing a simple discovery client/server app using Java (for the server) and a LiveCode app on iOS for the client.

The server responds to a broadcast request just fine and I am able to get a response into LiveCode.

However the data is somehow coded differently to normal strings.

The java code to send the datagram looks like this:

serverSocket.send(new DatagramPacket(sendData, 1024, IPAddress, 9877));

sendData is a byte array.

The LiveCode that receives this packet looks like this:

mergSocketAcceptConnections 9877,true

I tried putting the data received into a database using revExecuteSQL, but I get an "Unrecognised token" error returned.

I need to either format the data before sending it from Java or process it after receiving it in LiveCode.

DanTheMan
  • 41
  • 7

1 Answers1

1

Self found answer... I was sending a load of null characters with the datagram packet. These also made it into the string, but of course depending on the function, it either displayed correctly or caused the function to fail.

Solution was to only send the data I need and not the entire array. i.e.

String myData = "Some data, that I need to send to the client...";
sendData = myData.getBytes();
DatagramPacket(sendData, myData.length(), IPAddress, 9877));
DanTheMan
  • 41
  • 7