Guest User

Untitled

a guest
Jul 11th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. void ReadThread::run(Client& client)
  2. {
  3. QString result;
  4.  
  5. while (1)
  6. {
  7. result = client.receiveText();
  8. emit messageReceived(result);
  9. }
  10. }
  11.  
  12.  
  13. QString Client::receiveText()
  14. {
  15. int bytesToRead;
  16. char *bp;
  17. size_t i;
  18. QString *result;
  19.  
  20. bp = Client::rbuf_;
  21. bytesToRead = BUFLEN;
  22.  
  23. i = 0;
  24. while ((i = recv (Client::clSocket_, bp, bytesToRead, 0)) < BUFLEN)
  25. {
  26. bp += i;
  27. bytesToRead -= i;
  28. }
  29. result = new QString(rbuf_);
  30. return(*result);
  31. }
Add Comment
Please, Sign In to add comment