Home > Back-end >  get remaining data size on tcp socket on mingw
get remaining data size on tcp socket on mingw

Time:02-01

I want to get size of remaining data on tcp socket.

On linux I can do this:

#include <sys/ioctl.h>
int count;
ioctl(sockfd, FIONREAD, &count);

But this does not work with mingw, is there any alternative solution that works in mingw?

CodePudding user response:

I found the solution:

#include <winsock2.h>
unsigned long count;
ioctlsocket(sockfd, FIONREAD, &count);
  •  Tags:  
  • Related