Passing argument to setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, intr)

дамјан г. mk at net.mail.penguinista
Wed Apr 21 10:41:34 EDT 2004


> Does anyone know the correct way to pass the 'device' argument to
> setsockopt with the SO_BINDTODEVICE flag?
> 
> I have tried various methods:
> 
> setsockopt(socket.SOL_SOCKET,IN.SO_BINDTODEVICE,"eth0")
> setsockopt(socket.SOL_SOCKET,IN.SO_BINDTODEVICE,inet_aton("eth0"))
> setsockopt(socket.SOL_SOCKET,IN.SO_BINDTODEVICE,struct.pack("s","eth0"))

I think you need 
        struct.pack("5s","eth0") 


-- 
Дамјан                                  (jabberID:damjan at bagra.net.mk)

A: Because it reverses the logical flow of converstion.
Q: Why is top posting frowned upon?



More information about the Python-list mailing list