Calling getsockopt with SO_RCVBUF will return the allocated size of the socket receive buffer.
I am curious to know if it is possible to
The sufficient size for the socket receive buffer is given by the bandwidth-delay product for the link. Bandwidth in. Bytes/second times delay in seconds = buffer size in bytes. The idea is to advertise a TCP window large enough that the sender can 'fill the pipe'. You can calculate that in advance: you don't need to tune it at runtime. Sizes towards 64k are good.