tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: binding a socket to a specific interface

>Is there a way to bind a socket to a specific interface?
>The check_dhcp monitoring plugin needs to do that; on Linux, it does
>	setsockopt(sock, SOL_SOCKET, SO_BINDTODEVICE, ...)
>else it does nothing really, making my DHCP checks fail.

I think you can discover all of the interfaces with getifaddrs(), and
then use bind() to bind to the interface address for the one you want.


Home | Main Index | Thread Index | Old Index