Quote:
Originally Posted by
jim mcnamara
I don't get your point, network interfaces (sockets) are directly associated with file descriptors, at least in all of the boxes I've seen. Ditto eth0:, bge0:, etc., (nics) or whatever you call yours.
They are not present as files, there's no /dev/eth0 for example. This is very different from any other kind of UNIX device -- terminals, disks, even random number sources are all available as files and can be handled with open/read/write/close. Networking is not. It doesn't even use open/read/write, though it does share close().
Quote:
If you are crazy, or on Linux you can call ioctl() on eth0:. Why? because ioctl works on files.
ioctl works on file
descriptors. First, you have to
open that somehow, and that's not done through the normal channels.
The example first shows how to twiddle settings on a serial port /dev/ttyS0. That
is a file.
Then it shows how to do so on a network interface, starting with a socket() call instead.