I'm working on an API that should connect via IPv4 and Ipv6 to a server via UDP packets and send/receive information to/from that server.
Please see the below example. This seems to work even though I've specified "udp" and not "udp6" (Both server and client address are local to a network) package main import ( "fmt" "net" ) func CheckError(err error) { if err != nil { fmt.Println("Error: " , err) } } func main() { ServerAddr,err := net.ResolveUDPAddr("udp","[0:0:0:0:0:ffff:c0a8:cd36]:5400") CheckError(err) LocalAddr, err := net.ResolveUDPAddr("udp", "[0:0:0:0:0:ffff:c0a8:130]:5400") CheckError(err) Conn, err := net.DialUDP("udp", LocalAddr, ServerAddr) CheckError(err) defer Conn.Close() } However, once I replace those "udp" strings with "udp6" as indicated in the documentation, I get an error from the DialUDP() method "dial udp6 192.168.1.48:5400->192.168.205.54:5400: bind: can't assign requested address". For what it's worth, the code works if I replace those ipv6 strings with their ipv4 strings and use "udp4" instead of "udp". Can someone explain why udp6 doesn't seem to work? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.