Closed gen2brain closed 5 years ago
Following example returns an error listen udp 127.0.0.1:1234: address 127.0.0.1:1234: unexpected address type:
listen udp 127.0.0.1:1234: address 127.0.0.1:1234: unexpected address type
package main import ( "fmt" "os" "github.com/libp2p/go-reuseport" ) func main() { l, err := reuseport.Listen("udp", "127.0.0.1:1234") if err != nil { fmt.Println(err) os.Exit(1) } fmt.Println(l) }
You need to use ListenPacket. Listen doesn't support UDP.
ListenPacket
Listen
Following example returns an error
listen udp 127.0.0.1:1234: address 127.0.0.1:1234: unexpected address type
: