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

**URL:** <https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735>\
**Category:** Libraries\
**Created:** [October 22, 2018, 7:01am UTC](https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735 "2018-10-22T07:01:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanvi](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@Tanvi](https://discourse.processing.org/u/Tanvi)\
**Post date:** [October 22, 2018, 7:01am UTC](https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735/1 "2018-10-22T07:01:35Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![Quix](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quix/32/2011_2.png) [@Quix](https://discourse.processing.org/u/Quix)\
**Post date:** [October 22, 2018, 9:53am UTC](https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735/2 "2018-10-22T09:53:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Quix](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/quix/32/2011_2.png) [@Quix](https://discourse.processing.org/u/Quix)\
**Post date:** [October 22, 2018, 9:54am UTC](https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735/3 "2018-10-22T09:54:31Z")

</div>

[https://processing.org/reference/libraries/net/Server\_available\_.html](https://processing.org/reference/libraries/net/Server_available_.html)

---

<div class="post-metadata">

**Author:** ![Tanvi](https://avatars.discourse-cdn.com/v4/letter/t/9de053/32.png) [@Tanvi](https://discourse.processing.org/u/Tanvi)\
**Post date:** [October 22, 2018, 10:12am UTC](https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735/4 "2018-10-22T10:12:02Z")

</div>

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().

---

<div class="post-metadata">

**Author:** ![Francis89074](https://avatars.discourse-cdn.com/v4/letter/f/d07c76/32.png) [@Francis89074](https://discourse.processing.org/u/Francis89074)\
**Post date:** [April 7, 2019, 11:26pm UTC](https://discourse.processing.org/t/clientevent-is-slow-how-to-get-real-time-data-using-tcp-ip/4735/5 "2019-04-07T23:26:34Z")

</div>

I’m using [https://github.com/Protocentral/protocentral\_heartypatch/tree/master/gui\_software/protocentral\_heartypatch\_gui\_tcp](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?
