The file size is about 400k,I want to transfer the big file only one time,
I want to know I must use TCP or UDP?and Must I set the sending buffer or receiving buffer to 400k?
The file size is about 400k,I want to transfer the big file only one time,
I want to know I must use TCP or UDP?and Must I set the sending buffer or receiving buffer to 400k?
Ok, if this is a one time thing... I'd suggest just using your OS facilities... seriously...
If you're on windows, just put the thing in a shared folder and drag and drop it into the target machine.
Writing Winsock code for a one file, one time transfer would be a horrendous waste of time and effort...
To answer your questions:
400k is quite small by today's standard. You should use TCP because it guarantees that the packets are in order, where UDP does not. And you can set the buffer smaller if you want, and to multiple writes, but keep in mind the TCP/IP stack you're working on has it's own buffer (typically 1500 bytes IIRC), so it wont send your whole buffer in one shot anyhow.
Like Tater said, writing a program for this is silly, unless it's solely to learn about network programming. Read Beej's network programming guide for info on network programming. You should look into using the cURL library if you want to use specific protocols like FTP or HTTP. Also, you should do some general reading on ethernet and TCP/IP.