The Simplest Python UDP app (Help!)

@thomas thank you so much for helping me with this! And for explaining that!

How do you do that? When I try that I see on my terminal

$  flyctl ssh console
Update available 0.0.320-pre-1 -> v0.0.320.
Run "flyctl version update" to upgrade.
Connecting to top1.nearest.of.firstfly.internal... complete
Error error connecting to SSH server: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain

and on the logs online

2022-04-15T11:42:44.509 app[88283b4f] lhr [info] 2022/04/15 11:42:44 unexpected error: transient SSH server error: can't resolve _orgcert.internal
2022-04-15T11:42:44.617 app[88283b4f] lhr [info] 2022/04/15 11:42:44 unexpected error: [ssh: no auth passed yet, transient SSH server error: can't resolve _orgcert.internal]

I also tried:

$  flyctl ssh establish
Update available 0.0.320-pre-1 -> v0.0.320.
Run "flyctl version update" to upgrade.
Automatically selected personal organization: #####
Establishing SSH CA cert for organization personal
Error establish key failed: key exists and override not set

///////////

So, I decided to do it from scratch again, following the steps you took. And now it doesn’t crash on the log online but it also doesn’t print the “Hello Fly.io!” message, nor receive my UDP messages. For reference:

again, this is the python script I am using
import socket

print("Hello Fly.io!")

UDP_IP = "fly-global-services"
UDP_PORT = 5000

sock = socket.socket(socket.AF_INET, 
                     socket.SOCK_DGRAM) 
sock.bind((UDP_IP, UDP_PORT))

while True:
    data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes
    print("received message: %s" % data)
this is the Dockerfile I am using
ARG PYTHON_VERSION=3.7

FROM python:${PYTHON_VERSION}

RUN apt-get update && apt-get install -y \
    python3-pip \
    python3-venv \
    python3-dev \
    python3-setuptools \
    python3-wheel

RUN mkdir -p /app
WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

COPY . .


# replace APP_NAME with module name
CMD ["python", "simply.py"]
this is what the modified fly.toml looks like
# fly.toml file generated for firstfly on 2022-04-15T12:39:30+01:00

app = "firstfly"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []

[env]
  PORT = "5000"

[experimental]
  allowed_public_ports = []
  auto_rollback = true

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

  [services.concurrency]
    hard_limit = 25
    soft_limit = 20
    type = "connections"

  [[services.ports]]
    port = "5000"

[[statics]]
  guest_path = "/app/public"
  url_prefix = "/static/"
and this is the python script I am using to send UDP messages
import socket

UDP_IP = "firstfly.fly.dev"
UDP_PORT = 5000
MESSAGE = b"Hello, World!"

print("UDP target IP: %s" % UDP_IP)
print("UDP target port: %s" % UDP_PORT)
print("message: %s" % MESSAGE)

sock = socket.socket(socket.AF_INET, 
                     socket.SOCK_DGRAM) 
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))

here is the flyctl version:

flyctl v0.0.320-pre-1 darwin/amd64 Commit: 58aae1e BuildDate: 2022-04-13T12:19:08Z

Using fly wireguard websockets enable, following instructions received here.

And running on mac 10.15.7 Python 3.7.3.
Please let me know what else you think we can do next.
I appreciate your help trying to figure this out!