Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我发现我必须使用 ioctl。这里有类似的问题:
我的问题是:
由于没有可移植的方式来执行此操作(而且答案通常是错误的),因此没有内置的方式来请求它。
如果您使用非阻塞套接字,只需读取尽可能多的数据,并且只返回存在的数据。
你可以得到那个数字,但这个数字没有多大用处。在内核读取数字和您的代码实际使用它之间有一个时间窗口。在那个窗口中,更多的数据可以到达套接字。换句话说,这个数字很可能是陈旧的。