Yeah, very nice effort, great code.
Would be desirable as a userlib and a replacement for Send/ReceiveNetworkFile. E.g. SendNetworkFilePlus and ReceiveNetworkFilePlus. On every call it returns the progress status (thus spare a callback).
At last (and i don't wanna spoil the fun):
What happens if another/foreign packet (after checking for #SendFile once) triggers the #PB_NetworkEvent_Data event while receiving the file in the loop?
What happens if (more than) one packet overhauls another one? Will the resulting file be still valid/useable?
Fast buffered file transfer (new code, finished)
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
-
- Addict
- Posts: 841
- Joined: Mon Jun 07, 2004 7:10 pm
@ Bonne_den_kule:
Please keep in mind that ReceiveNetworkData() and SendNetworkData() could return -1 (#SOCKET_ERROR) if something goes wrong.
In this case your "BytesSended" calculation is wrong. I also fall into this hole some years ago.
You should allways check for <>-1 and catch WSAGetLastError_() if -1 is returned by one of these commands. (WSA_Would_Bock is an error which often happens in low bandwith or busy networks)
Mike
Please keep in mind that ReceiveNetworkData() and SendNetworkData() could return -1 (#SOCKET_ERROR) if something goes wrong.
In this case your "BytesSended" calculation is wrong. I also fall into this hole some years ago.
You should allways check for <>-1 and catch WSAGetLastError_() if -1 is returned by one of these commands. (WSA_Would_Bock is an error which often happens in low bandwith or busy networks)
Mike
Tranquil