I’m using Linux 2.6.38 (fc14). What is the ioctl flag to get the amount of free space on a socket file descriptor (say, a TCP socket)? I found NetBSD has FIONREAD, FIONWRITE and FIONSPACE for such related purposes. But, I could only use FIONREAD in Linux.
Share
SIOCOUTQis the Linux equivalent ofFIONWRITE. I don’t believe there is a directFIONSPACEequivalent: instead, you can subtract the value returned bySIOCOUTQfrom the socket send buffer size, which can be obtained withgetsockopt(s, SOL_SOCKET, SO_SNDBUF, ...).