Guest User

Untitled

a guest
Feb 25th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. const int _size=4096;
  2. char _buf[_size];
  3.  
  4. FILE* file;
  5. file = fopen(address.c_str(), "rb");
  6. int BytesRead = 0;
  7. while (!feof(file)) {
  8. ZeroMemory(_buf, _size);
  9. BytesRead = fread(_buf, 1, _size, file);
  10. if (BytesRead > 0) {
  11. send(_skt, _buf, BytesRead, 0); // send data
  12. cout << BytesRead << endl;
  13. ZeroMemory(_buf, _size);
  14. recv(_skt, _buf, _size, 0); // receive SUCCESS
  15. }
  16. }
  17. send(_skt, "eof", 3, 0); // send eof
  18. fclose(file);
  19. cout << "transmitting successful" << endl;
Add Comment
Please, Sign In to add comment