in reply to Send many file via socket

Who is they in "they told me that via socket I could do it"? Did they also tell you that you couldn't use any of the many programs already written for this purpose like scp or ftp?

Inventing your own file-transfer protocol seems like a fun way to waste a lot of time though. I'd do it by writing out a little MIMEy header for each file. Something like:

Filename: foo.zip Size: 100010

Then send the file, no encoding needed since the server knows how much data to expect. A new header could be sent after the file to send another file, or some kind of "All Done" message. The code for client and server should be easy to write.

Of course this lacks all kinds of nice stuff that scp or ftp will do for you! Key stuff to worry about - security, wacky characters in filenames, losing the network connection in the middle of a transfer, etc.

-sam

Replies are listed 'Best First'.
Re^2: Send many file via socket
by runrig (Abbot) on Apr 03, 2008 at 20:45 UTC
    Also, FTP and SCP both use sockets...so maybe by "use sockets", they meant use FTP or SCP or some otehr standard socket protocol. Maybe this is a test...to see whether or not he rolls his own.