Python UDP server connection issues

So Im trying to host a python UDP server (that I have tested locally and know it works)

From everything ive seen online, ive done everything right up until this point, but i cant seem to connect to my server.

I will attach paste my fly.toml and procfile, and snips of my python. Also note, i do have an empty requirements.txt.

fly.toml -

app = "app-name"
kill_signal = "SIGINT"
kill_timeout = "5s"

[experimental]
  auto_rollback = true

[build]
  builder = "heroku/buildpacks:latest"

[[services]]
  protocol = "udp"
  internal_port = 5000

  [[services.ports]]
    port = 5000

[[statics]]
  guest_path = "/app/public"
  url_prefix = "/static/"

Procfile -

web: python Server.py

Server.py

port = 5000
addr = "fly-global-services"
socket.bind((addr, port))
print('server is running')

After deploying my project with flyctl launch, i get this:

This deployment will:
 * create 2 "app" machines

No machines in group app, launching a new machine
  Machine 1a1a111a11a111 [app] update finished: success
Creating a second machine to increase service availability
  Machine 2a1a111a11a112 [app] update finished: success
Finished launching new machines
Updating existing machines in 'app-name' with rolling strategy
  Finished deploying

When i run flyctl logs, i get back the print statement i put in my python script, and other indications that its running properly:

app[1a1a111a11a111] Pulling container image
app[1a1a111a11a111] Successfully prepared image
app[1a1a111a11a111] Starting init
app[1a1a111a11a111] Running server script
app[1a1a111a11a111] server is running

app[2a1a111a11a112] Pulling container image
app[2a1a111a11a112] Successfully prepared image
app[2a1a111a11a112] Starting init
app[2a1a111a11a112] Running server script
app[2a1a111a11a112] server is running

I have tried activating my ipv4 address though both the text prompt running flyctl launch in cmd:

Would you like to allocate a dedicated ipv4 address now? (y/n)

And running this command: flyctl ips allocate-v4

Is there something im missing?

Hi @joshshowman

The steps look correct: external/internal ports match, you bind to fly-global-services and you have a dedicated IP address.

Could you please clarify what’s not working? What does your app do when it receives an UDP packet?

Hello!
My server never receives the packet. I have code elsewhere in my python script that lets me debug and such, and I have no issues there. Thanks for any input!
-Edit
And sorry for the delayed response, didnt see the email for this.

I tried to send a simple text string (123) to port 5000 of your app and I see it got printed in the logs. So it looks like the server is receiving correctly. I got no reply, but without knowing what your server is doing I can’t say whether this is correct or not.

i see! it must be something in my call? ive tried using both app-nam.fly.dev and the ip to no avail. its worked across local network.

It might be a problem with UDP in your network (e.g. filtered by router/propvider, for example). It’s very hard to say with UDP.
I’ve also tried another server that I have access to, and it seems it can also send UDP packets to your app just fine.

Thank you so much for your help! Im trying to figure out if it might be a firewall thing, not 100% sure yet.
I got one question regarding fly.io itself, and thats the dual machines that are automatically setup.
I noticed that one machine received the first message, and the other received the other, is there a reason for this?

flyctl sets up two machines by default for better reliability. The traffic should be spread relatively equal between the machines.
If you are expecting to receive the packets on one machine only, you might need to downscale to just one. This can be achieved by destroying one of the machines: fly machines destroy <id>.
On the first deploy, you can opt out of this behavior by passing --ha=false flag: fly deploy --ha=false.