Binary File Transfer

I have written a program in C to transfer files between 2 machines . The program uses UDP . At the server the file is saved in the current directory using fwrite . Everything seems to be working exept for one problem . The binary files gets corrupted on the server . Thats is doing a diff of the files in the server and client says it differs . Though the checksum at the server is passed . The bytes at both server and client matches . But ...
Though it works when it comes to text files being passed .
I am stuck and i have nowhere to go .

The above problem dosent show when i make a TCP connection ....

ANy ideas will be appreciated

DP

UDP is unreliable by intent, I would expect that some datagrams would be lost. I can't believe that there is a difference between ascii and binary data. I can believe that there is a difference between a little bit of data and a lot of data. Could you be using small ascii files and large binary files? And your comment that the bytes match throws me. If the bytes are ok, what more do you ask from a file transfer?

Well What do i ask,
let me explain
I transfer an image over to the server .
Technically speaking The image should open at the server .
The message is Data corrupted ... cant open
Bytes match at server and client
Checksum match at server and client
Works for ascii text
diff command shows binary files at both places differ

Got it ...

I mean wats the use of this program if th binary file cannot make sense

DP:)