Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int _size=4096;
- char _buf[_size];
- FILE* file;
- file = fopen(address.c_str(), "rb");
- int BytesRead = 0;
- while (!feof(file)) {
- ZeroMemory(_buf, _size);
- BytesRead = fread(_buf, 1, _size, file);
- if (BytesRead > 0) {
- send(_skt, _buf, BytesRead, 0); // send data
- cout << BytesRead << endl;
- ZeroMemory(_buf, _size);
- recv(_skt, _buf, _size, 0); // receive SUCCESS
- }
- }
- send(_skt, "eof", 3, 0); // send eof
- fclose(file);
- cout << "transmitting successful" << endl;
Add Comment
Please, Sign In to add comment