Solved!
The issue is the code in my app server was binding to localhost and by default that binds to the IPV6 address of ::1
Passing a host of localhost to net.connect assumes IPV4 and doesn't work.
The mac command line telnet and nc both work fine with this and connect correctly.
Two solutions:
- App binds to 127.0.0.1 and localhost in node works fine
- Set host address to ::1 in test.js and it connects via ipv6
All fixed now though :)
gaz