Change address family to AF_INET

This fixes socket() EAFNOSUPPORT error on Linux (worked perfectly on Windows!).
Move version download code to separate file