If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
I want to use wxSocketServer to receive bindery data.
wxSocketBase::Read function may get me null-terminated data string, but how do I get the size of binary data (that may contain zeros)?
Is my only option is using something like this?:
Thanks but I didn't get it, sizeof what?
You should supply your buffer and its size to wxSocketBase::Read(). you can get the whole buffer at one shot if you know the socket's received data size, so my question was how to get this size, when dealing with binary data.
while(sock && sock->IsData()){ // Don't call a member of a pointer if the pointer isn't valid
sock->Read(buf, sizeof(buf)); // Read in bytes upto the size of buffer
wxUint32 bytesRead = sock->LastCount(); // How many bytes were read in.
}
while(sock && sock->IsData()){ // Don't call a member of a pointer if the pointer isn't valid
sock->Read(buf, sizeof(buf)); // Read in bytes upto the size of buffer
wxUint32 bytesRead = sock->LastCount(); // How many bytes were read in.
}
-Max
Thanks!
For some reason, I missed that LastCount()