This is probably a very simple thing. I'm new to python so don't crucify me.
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, IN.SO_BINDTODEVICE, "eth1"+'')
the above command gives me:
NameError: name 'IN' is not defined
the only import I have is
If you don't understand the error message, it means you're referring a name
IN which does not exist. You should start with a Python book; you can't get far if you don't know the most basic things.
If you can't find the SO_BINDTODEVICE symbol, the reason may be that it's not available on your system. If you are absolutely sure that you're running on Linux that supports it, try replacing it with it's numerical value, which is
s.setsockopt(socket.SOL_SOCKET, 25, "eth1"+'')
What are you trying to achieve? If you're trying to bind the socket to a physical device, use socket.bind.
More can be found here:
Python Docs: Socket Objects
Python Docs: Code example