title: Tell whether a text string is an IPv6 address or IPv4 address using standard C sockets API
body: <p>I have a program where an external component passes me a string which contains an IP address. I then need to turn it into a URI. For IPv4 this is easy; I prepend http:// and append /. However, for IPv6 I need to also surround it in brackets [].</p>
  
  <p>Is there a standard sockets API call to determine the address family of the address?</p>