Get the amount of data pending in the OS input buffer, without blocking.
If socket is a UDP or SCTP socket, this will return the size of
just the next packet, even if additional packets are buffered after
that one.
Note that on Windows, this function is rather inefficient in the
UDP case, and so if you know any plausible upper bound on the size
of the incoming packet, it is better to just do a
Socket.receive with a buffer of that size, rather than calling
Socket.getAvailableBytes first and then doing a receive of
exactly the right size.
Get the amount of data pending in the OS input buffer, without blocking.
If socket is a UDP or SCTP socket, this will return the size of just the next packet, even if additional packets are buffered after that one.
Note that on Windows, this function is rather inefficient in the UDP case, and so if you know any plausible upper bound on the size of the incoming packet, it is better to just do a Socket.receive with a buffer of that size, rather than calling Socket.getAvailableBytes first and then doing a receive of exactly the right size.