Sending out UDP packets fast without context (connection)?

Unfortunately WriteToUDP fails with the error message “use of WriteTo with pre-connected connection” - so it seems this can’t change the target of a connection either. Somehow it makes sense, because otherwise the server part of UDPconn would not know which UDP packets to accept without memorizing all the peer IPs (a feature I’m not interested in, but which I assume UDPconn is doing under the hood).

Listening to a socket does not solve the problem - I don’t even need to do that, as I do not expect and UDP packets back. I ONLY need to send out UDP packets, but with (many) varying destination IPs. You can visualize this as a “UDP bomb” (and no, this has nothing to do with DDOS attacks, it’s just a picture :slight_smile: ) The only reason I would require the UDPconn object is because I must be able to define a source port number (in the outgoing UDP packet, as mentioned I do not need to listen on it at all). Without this need, I could just send out UDP packets without worrying about a dialUDP call.

Multicasting would not work neither, as I can’t influence the destination side, and so I can’t build up a multicast group with those.

1 Like