TCP and UDP service ports don't work

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

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

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

[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:

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:

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?

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

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

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

That indeed fixes the problem. Thanks!

1 Like

Oh… hello once again, Pekka. Didn’t realise it was you! ChiselStrike on Fly?

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 :wink:

1 Like