if_nametoindex() needed to be able to use interfaceIndex

28 views
Skip to first unread message

Antoine Martin

unread,
Aug 11, 2009, 8:23:44 AM8/11/09
to pybonjour
See:
http://developer.apple.com/qa/qa2007/qa1513.html

This code does it:
'if_nametoindex':
(
ctypes.c_int,
NO_ERRCHECK,
NO_OUTPARAM,
(
_utf8_char_p, # name
)
),

[...]

def if_nametoindex(name):
_global_lock.acquire()
try:
return _if_nametoindex(name)
finally:
_global_lock.release()

Christopher Stawarz

unread,
Aug 12, 2009, 11:07:06 AM8/12/09
to pybo...@googlegroups.com
Hi Antoine,

if_nametoindex() is part of the C standard library, not libdns_sd, so
I don't think it belongs in pybonjour. Someone submitted a patch to
have it added to Python's socket module, but it hasn't been accepted
yet:

http://bugs.python.org/issue1746656

At the moment, you can make it available in your own code using ctypes.


Cheers,
Chris
Reply all
Reply to author
Forward
0 new messages