   Data pending... please read
  I am trying to avoid multithreading in my program (no, I can''t use any WINAPI sync stuff) and it would be very convenient to be able to find out how many bytes are pending, or just if there are any pending or not. Does anyone know how to do this with Winsock? Really I just need to know IF there are any pending, but how many is good aswell. Thanks, ~SPH 
  DWORD YourSocketClass::BytesPending() const{DWORD dwPending = 0;if( m_hSocket != INVALID_SOCKET )ioctlsocket( m_hSocket, FIONREAD, &dwPending );//this is the interesting line return( dwPending );};;Thanks, but I eventually found that I could use the select function to do it, is there an advantage to using ioctlsocket ?~SPH;quote:Thanks, but I eventually found that I could use the select function to do it, is there an advantage to using ioctlsocket ?Yes, the ioctl can be used for a single specific socket with less overhead compared to using select() for a single socket.  When using select, keep in mind that it is implemented differently on Windows than on other systems.  This could lead to performance problems in porting to different platforms.;Ah thanks, I''ll change my code to use ioclsocket instead .Thanks, ~SPH