Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
syscall: Recvfrom fails with "address family not supported by protocol family" if incorrect buffer provided #4352
What steps will reproduce the problem? 1. http://play.golang.org/p/Twk04P1T37 2. Call ReadFromUDP with slice of length 0 What is the expected output? IDNK. Maybe another error. What do you see instead? strange error message Which compiler are you using (5g, 6g, 8g, gccgo)? default "go build" compiler Which operating system are you using? Mac OS X Which version are you using? (run 'go version') go version go1.0.3 Please provide any additional information below.
Sure, looks a bit strange. When you pass a zero-length slice to net.ReadFrom/UDP, underlying syscall.Recvfrom calls SYS_RECVFROM and gets error = 0 (read succeeded) with unfilled sender's socket address. That all-bit zero sockaddr is treated as unknown address in syscall.Recvfrom and that's the reason why you have an error EAFNOSUPPORT.