The only difference is as Mat mentioned that udp6 uses IPv6 and udp4 uses IPv4. The type parameter you specify when creating a socket indicates which interface will be used. The rest of the API is the same.
type