I had very similar code working in an old version of perl. I upgraded and then only received connection failure. Connection failure was silent.
I moved back to old version of perl and connections worked fine (also made sure I used the same packages and same code). The perl version that worked on my windows 7 64 bit machine was 5.14.2 build 1402. The version that did not work was 5.16.3 build 1604.