# Issue running service\_counter and service\_client examples

**URL:** <https://discourse.farm-ng.com/t/issue-running-service-counter-and-service-client-examples/386>\
**Category:** support\
**Created:** [July 9, 2024, 6:42pm UTC](https://discourse.farm-ng.com/t/issue-running-service-counter-and-service-client-examples/386 "2024-07-09T18:42:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![larslundqvist](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/larslundqvist/32/305_2.png) [@larslundqvist](https://discourse.farm-ng.com/u/larslundqvist)\
**Post date:** [July 9, 2024, 6:42pm UTC](https://discourse.farm-ng.com/t/issue-running-service-counter-and-service-client-examples/386/1 "2024-07-09T18:42:56Z")

</div>

Hi there,

I’m attempting to run both the [service\_counter](https://amiga.farm-ng.com/docs/examples/service_counter/) and [service\_client](https://amiga.farm-ng.com/docs/examples/service_client/) examples and am encountering issues with the second terminal (step 2) for both. The steps I’ve followed for setting up my environment were:

- Followed the [instructions](https://amiga.farm-ng.com/docs/brain/brain-install#install-from-source-advanced) for installing from source
- Navigated to py/examples/service\_client (w/ venv activated)
- Started the service with python service.py --service-config config.json, leading to the expected output (Sending /health…)
- Created a second terminal, reactivating the venv and navigating to the same directory.
- Attempted to run the client with python client.py --service-config config.json --a 1 --b 2

However, the second terminal hangs after running that command. I’ve replaced the “host”: localhost with the appropriate Tailscale address for the brain for both examples’ config files.

Please let me know if you have any insights as to why this may not be working or if I’ve missed something with the environment setup.

---

<div class="post-metadata">

**Author:** ![MScatolin](https://yyz1.discourse-cdn.com/flex031/user_avatar/discourse.farm-ng.com/mscatolin/32/312_2.png) [@MScatolin](https://discourse.farm-ng.com/u/MScatolin)\
**Post date:** [July 10, 2024, 4:29pm UTC](https://discourse.farm-ng.com/t/issue-running-service-counter-and-service-client-examples/386/2 "2024-07-10T16:29:36Z")

</div>

Hey @larslundqvist ,

The second terminal printing nothing indicates that the target service is not publishing anything, which tells me that either the service in not properly setup or you are looking in the wrong place.

In you specific case, I believe the problem is that, when you start the service, it starts on your local machine, not on the robot. If you take a look at the example, you will see that `EventServiceGrpc` calls [`grpc.aio.server()`](https://grpc.github.io/grpc/python/grpc.html#grpc.server) which starts a local server. Looks like the confusion here is that we are using the same `config.json` on `service.py` and `client.py` even though service don’t use the host parameter. I believe we can make a better job on making that clear on the example page, so, thank you for pinpointing that!

So, basically, try to ssh’in on the robot, start the service, and them use `client.py` to subscribe to it from within the robot listening on `localhost` or from your local machine listening on your machines Tailscale IP address.
