Calling getsockopt with SO_RCVBUF will return the allocated size of the socket receive buffer.
getsockopt
SO_RCVBUF
I am curious to know if it is possible to
use the SIOCINQ ioctl() on the socket to learn the amount of queued incoming bytes.
Similarly there's SIOCOUTQ for querying the send buffer.