Is there a way in sockets to check if there is data in the buffer without using recv()? I'm writing this program that works with a protocol and I just ran into a packet that gets compressed. So there is no way of knowing how big the packet is until it is decompressed. I cannot decompress it if I don't know its size, since if I call recv with too big of a value, then it just blocks forever until more data is sent. So is there a way to check against the buffer? My socket class takes data one byte a time, so I could have it call up that function then return as soon as buffer is empty.
For now I just want to ingnore the compressed packets till I figure out how to code the algorithm to decompress them (it's gzip I think). With this particular application I can get away with ignoring packets, as long as I still take them properly, so the next packet can be handled properly.
For now I just want to ingnore the compressed packets till I figure out how to code the algorithm to decompress them (it's gzip I think). With this particular application I can get away with ignoring packets, as long as I still take them properly, so the next packet can be handled properly.