Has there been resolution on this? I get this error now and then, too. On Tuesday, August 2, 2016 at 12:25:09 PM UTC-6, Jakob Borg wrote: > > > On 2 aug. 2016, at 15:19, CN47 <akrc...@gmail.com <javascript:>> wrote: > > 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? > > > Those are IPv4-mapped IPv6 addresses, which is to say regular IPv4 > addresses expressed in IPv6 syntax for compatibility purposes. You are > using an IPv4 connection, which is why "udp" and "udp4" work but "udp6" > doesn't. > > //jb > >
-- 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.