UDP Service not working (following docs)

I’ve followed the docs which help with setting up a UDP service and deploying it given the provided github repo. Fortunately so far, everything looked fined and I was able to perform the test with netcat (echo "hello world" | nc -w1 -u *.fly.dev 5000) and got “hello world” back. When I tried with my own coap server it wouldn’t be reachable by my client. I can’t seem to find out why.

I did bind on the fly-global-services and also opt-in for a dedicated ipv4.


app = 'snitch-server'
primary_region = 'ams'

auto_start_machines = true
auto_stop_machines = true
internal_port = 5000
min_machines_running = 0
protocol = "udp"

port = 5000

cpu_kind = 'shared'
cpus = 1
memory = '1gb'


FROM golang:1.22-alpine as build

COPY go.mod go.sum ./

RUN go mod download

COPY . ./

RUN go build -o coap-server ./cmd/coap-server

FROM alpine:latest

COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /app/coap-server /app

CMD [ "./coap-server" ]

go server:

func main() {
	r := mux.NewRouter()
	r.Handle("/a", mux.HandlerFunc(handleA))
	r.Handle("/b", mux.HandlerFunc(handleB))

	go func() {
		log.Fatal(coap.ListenAndServe("udp", "fly-global-services:5000", r))
	log.Println("🫡 Listening for a coap message on port 5688")
	select {}

Hi… This line might be the problem. Last I heard, auto-start was not actually supported for UDP, :dragon:.

Hope this helps a little!

Added machines, proxy

Tried it today, but didn’t detect any change of behavior.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.