Answer the question
In order to leave comments, you need to log in
Why can the program crash here?
If I send it to a regular computer, then it's normal, but if it's on Android, it crashes...
bool Socket::sendAll(void *buffer, int size) {
if (!isValid()) return 0;
char *ptr = (char*) buffer;
int counter = 0;
while (size > 0)
{
int sz = ::send(m_sock, ptr, size, 0);
usleep(1000);
if (sz < 1) {
counter++;
if (counter > 10000) return false;
continue;
}
ptr += sz;
size -= sz;
}
return true;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question