I'm writing a program for file transfering like ftp and i'm currently debugging it in Windows. The main piece of code is a simple while loop with read/write and send/recv calls and the cycle ends when the buffer we read is null. This code works perfectly when transfering a plain text files with only ASCII symbols in it. But if i try sending a non-text file (like zip archive or exe) it doesn't read the whole file but only a small piece of it is read and then it finds the EOF (null buffer is returned). So i read the manual and it says that some systems distinguish text files and binary ones, and in order to read binary data on such systems 'b' option should be presented in at file creation like f=file(file_name,'rb'). And i set this mode and now the size of non-text files received is allways greater then the size of the source ones. And when i try for example to open an archive it says 'unexpected end of archive'. So how to read binary files?
Sounds like the file modes are alright. Are you using the socket module? You need to make sure all the data is sent by checking the return value of .send(data) on your socket (how much was sent).
Otherwise post relevant sections of your code for us to look at.