I uploaded details of a working winsock implementation here, but as you will see it's not a simple business.

The ping / parse is a good solution.

I'll knockup a simple name resolution executable if you think it would be usefull.