[Go1.1] TCP dialer.LocalAddr not working on Windows

181 views
Skip to first unread message

Bruce Fitzsimons

unread,
Apr 23, 2013, 2:59:05 AM4/23/13
to golan...@googlegroups.com
Hi Gophers,

I struck this problem on the weekend when my multi-platform solution ( github.com/Bwooce/conchk ) didn't work on Windows. It had to wait until today when I had access to a Windows box.

I've boiled it down to the LocalAddr binding not working correctly, but it apparently works 100% on Mac&Linux. I suspect a difference in stack behaviour.

Representative example code that fails on Windows (XP):

http://play.golang.org/p/ik8aLj-vk_

The address resolution works, but the Dial failed with "An invalid argument was supplied". Commenting out the LocalAddr resolution e.g. not specifying one, makes it work but doesn't achieve the goal.

Am I doing something wrong, or is there some hither-to-undiscovered weirdness about this on Windows? 

Thanks,
Bruce

Mikio Hara

unread,
Apr 25, 2013, 2:03:01 AM4/25/13
to Bruce Fitzsimons, golan...@googlegroups.com
On Tuesday, April 23, 2013, Bruce Fitzsimons wrote:
Representative example code that fails on Windows (XP):
(snip)
Am I doing something wrong, or is there some hither-to-undiscovered weirdness about this on Windows?  

Looks like a careless use of Loopback and IPv6 stuff will cause
some errors on some version or feature set of Windows. So just
skipping tests that using Loopback and IPv6 on Windows might
be a work around.

Bruce Fitzsimons

unread,
Apr 25, 2013, 3:19:22 AM4/25/13
to golan...@googlegroups.com, Bruce Fitzsimons
Hi Mikio,


On Thursday, 25 April 2013 16:03:01 UTC+10, Mikio Hara wrote:
 So just
skipping tests that using Loopback and IPv6 on Windows might
be a work around.


I used the loopback in this example ( http://play.golang.org/p/ik8aLj-vk_ ) so I could share it, but the same behaviour is evident when using the other interfaces as the LocalAddr. The example is IPv4 too, so I don't understand your IPv6 reference.

Does the example work for you? 

Cheers,
Bruce

brainman

unread,
Apr 26, 2013, 12:47:03 AM4/26/13
to golan...@googlegroups.com, Bruce Fitzsimons
Bruce,

I can see the problem: http://code.google.com/p/go/issues/detail?id=5355. Thank you for report.

Alex
Reply all
Reply to author
Forward
0 new messages