Commit 3a239166 authored by Xavier Thompson's avatar Xavier Thompson

Add getaddrinfo.pyx demo

parent 591a0141
from stdlib.string cimport Str
from stdlib.socket cimport getaddrinfo
from libc.stdio cimport printf, puts
from libc.string cimport strlen
def main():
with nogil:
l = getaddrinfo(NULL, Str("3490"), 0, 0, 0, 0)
for a in l:
s = a.sockaddr.to_string()
printf("%d %d %d %s %s\n", a.family, a.socktype, a.protocol, Str.to_c_str(a.canonname), Str.to_c_str(s))
main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment