clientEvent() is slow. How to get real-time data using TCP/IP?

Hi, I am trying to get real-time data from pocket beaglebone [server] (sample rate @ 250 Hz) using TCP/IP in Processing 3.4 [client].
Library imported: Network

I used clienEvent() which as per reference (https://processing.org/reference/libraries/net/clientEvent_.html) should ideally be called at every byte; around 250 times/sec in this case.
But the call rate is only 20/sec approx.

Is clientEvent()/ TCP protocol always this slow in processing? Is it even possible to get real-time data using TCP/IP? If yes, please share insights on possible workarounds.

Appreciate your time. Many thanks.

use “Client client = myServer.available();” ? maybe it’s faster

1 Like

https://processing.org/reference/libraries/net/Server_available_.html

1 Like

Hey, thanks for the idea. Since my server is a C+ file and not processing, I will have to check how I can incorporate this.

Right now I am using myClient.available().

I’m using https://github.com/Protocentral/protocentral_heartypatch/tree/master/gui_software/protocentral_heartypatch_gui_tcp to get data from a hardware ECG, I have the firmware source code also.

The Processing executable I have works fine but if I try to build and run the source with the latest Processing 3.5.3 it has the same problem as reported here. Copying over the net.jar from the exported application to the new 3.5.3 exported application makes it work, so it seems there is a problem with the net.jar code

I looked through the issues and don’t see this reported and also looked at the software changes.

I’m on Windows 10. The exported application works fine once I replace it with an older net.jar (9/5/2017). The firmware is sending the data out and works with the exported processing executable and also the python script provided.

Any ideas on debugging this?