# TCP and UDP service ports don't work

**URL:** <https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746>\
**Category:** Questions / Help\
**Created:** [December 31, 2022, 12:23pm UTC](https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746 "2022-12-31T12:23:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![penberg](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/penberg/32/5778_2.png) [@penberg](https://community.fly.io/u/penberg)\
**Post date:** [December 31, 2022, 12:23pm UTC](https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746/1 "2022-12-31T12:23:09Z")

</div>

I followed the steps in the following article to create a service that uses TCP and UDP ports:

> **[Running Fly Apps On UDP and TCP](https://fly.io/docs/networking/udp-and-tcp/)**
>
> Documentation and guides from the team at Fly.io.

in fact, I just cloned the example repository and deployed it:

> **[GitHub - fly-apps/udp-echo-: Sample TCP/UDP Echo Service](https://github.com/fly-apps/udp-echo-)**
>
> Sample TCP/UDP Echo Service. Contribute to fly-apps/udp-echo- development by creating an account on GitHub.

However, it doesn’t seem to work. When I attempt to throw some packets at it, `netcat` just times out:

```auto
[penberg@turing iku-turso]$ echo hello world | nc penberg-echo-test.fly.dev 5000
Ncat: TIMEOUT.

```

I can ssh to the machine and see that there app is there listening:

```auto
root@fbe46807:/# lsof|grep 5000
udp-echo 525 root 3u IPv4 4426 0t0 UDP fly-global-services:5000 
udp-echo 525 root 7u IPv6 4430 0t0 TCP *:5000 (LISTEN)
udp-echo 525 526 udp-echo root 3u IPv4 4426 0t0 UDP fly-global-services:5000 
udp-echo 525 526 udp-echo root 7u IPv6 4430 0t0 TCP *:5000 (LISTEN)
udp-echo 525 527 udp-echo root 3u IPv4 4426 0t0 UDP fly-global-services:5000 
udp-echo 525 527 udp-echo root 7u IPv6 4430 0t0 TCP *:5000 (LISTEN)
udp-echo 525 528 udp-echo root 3u IPv4 4426 0t0 UDP fly-global-services:5000 
udp-echo 525 528 udp-echo root 7u IPv6 4430 0t0 TCP *:5000 (LISTEN)
udp-echo 525 529 udp-echo root 3u IPv4 4426 0t0 UDP fly-global-services:5000 
udp-echo 525 529 udp-echo root 7u IPv6 4430 0t0 TCP *:5000 (LISTEN)

```

and I can verify that the echo app is indeed working:

```auto
root@fbe46807:/# nc 127.0.0.1 5000
hello
hello
^C
root@fbe46807:/# 

```

Is the example project out-of-date? Is the `fly.toml` configuration file missing something?

---

<div class="post-metadata">

**Author:** ![ignoramous](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@ignoramous](https://community.fly.io/u/ignoramous)\
**Post date:** [December 31, 2022, 12:37pm UTC](https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746/2 "2022-12-31T12:37:06Z")

</div>

> [@penberg](#):
>
> Is the example project out-of-date?

You can say that.

IPv4 isn’t allocated by default, IPv6 is… _But_ connecting (raw TCP/UDP) over IPv6 also fails when IPv4s aren’t allocated: [Announcement: Shared Anycast IPv4 - #17 by Seventhnadir](https://community.fly.io/t/announcement-shared-anycast-ipv4/9384/17)

Allocate an IPv4 (costs $2/mo), and see if the example then works?

`flyctl ips allocate-v4 -a <app-name>`

---

<div class="post-metadata">

**Author:** ![penberg](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/penberg/32/5778_2.png) [@penberg](https://community.fly.io/u/penberg)\
**Post date:** [December 31, 2022, 1:05pm UTC](https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746/3 "2022-12-31T13:05:25Z")

</div>

That indeed fixes the problem. Thanks!

---

<div class="post-metadata">

**Author:** ![ignoramous](https://avatars.discourse-cdn.com/v4/letter/i/a9adbd/32.png) [@ignoramous](https://community.fly.io/u/ignoramous)\
**Post date:** [December 31, 2022, 1:18pm UTC](https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746/4 "2022-12-31T13:18:46Z")

</div>

> [@penberg](#):
>
> That indeed fixes the problem. Thanks!

Oh… [hello once again](https://twitter.com/rethinkdns/status/1592756154710773765), Pekka. Didn’t realise it was you! ChiselStrike on Fly?

---

<div class="post-metadata">

**Author:** ![penberg](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/penberg/32/5778_2.png) [@penberg](https://community.fly.io/u/penberg)\
**Post date:** [December 31, 2022, 1:44pm UTC](https://community.fly.io/t/tcp-and-udp-service-ports-dont-work/9746/5 "2022-12-31T13:44:45Z")

</div>

Hey! Yeah, we actually already migrated our ChiselNow infrastructure over to Fly already and it worked out really well! Blog post coming soon. And I am indeed now working on doing even more on Fly, but can’t yet share any details 😉
