The 0
as 2nd argument is converted to a string if it is a long or an int, so that it fits to the format the underlying API call supports for the ai_servname
field.
OTOH, the docs write that
o For internet address families, if you specify servname while you set
ai_socktype to SOCK_RAW, getaddrinfo() will raise an error, because
service names are not defined for the internet SOCK_RAW space.
If you replace that 0
with None
, it works.