Prefer using getaddrinfo()
You are using InetPton() to convert an IPv4 address to a sockaddr_in. However, this function has several drawbacks:
It does not perform DNS lookups, so you can't use a hostname to connect to a server.
You have to know up front which address family to use.
It doesn't fill in all of a sockaddr_in, it only provides you with the ...