I can use select() to determine if a call to recv() would block, but once I've determined that their are bytes to be read, is their a way to query how many bytes are currently available before I actually call recv()?
相关问题
- how to get selected text from iframe with javascri
- how to solve the issue with group by and aggregate
- Get all from one table and COUNT from another
- Prevent Anti-Virus to block outgoing email with C#
- PostgreSQL + Rails: is it possible to have a write
相关文章
- SELECT statement not using possible_keys
- Dplyr select_ and starts_with on multiple values i
- how to use jq to filter select items not in list?
- MySQL: Writing a complex query
- Codeigniter Select_Sum returns “array” not numeric
- Meteor blocking clarification
- Jquery's Chosen plugin with Chained plugin and
- Laravel Dusk + Vue with ElementUI
No, a protocol needs to determine that. For example:
If your OS provides it (and most do), you can use ioctl(..,FIONREAD,..):
Windows provides an analogous ioctlsocket(..,FIONREAD,..), which expects a pointer to unsigned long:
The ioctl call should work on sockets and some other fds, though not on all fds. I believe that it works fine with TCP sockets on nearly any free unix-like OS you are likely to use. Its semantics are a little different for UDP sockets: for them, it tells you the number of bytes in the next datagram.
The ioctlsocket call on Windows will (obviously) only work on sockets.