t-rex has asked for the wisdom of the Perl Monks concerning the following question:

i have implemented a concurrent server model , now i wish to transfer files from client to server , i checked send() api of the socket but in that i can't directly send the file , so i want to know what are the best options to transfer a file, can i use OpenSSH module (scp functions in that for transfer) ? I have read few old posts but none have used send directly to transfer files they have used file handles for some processing. pls help

  • Comment on Transfer file from client server in socket prog

Replies are listed 'Best First'.
Re: Transfer file from client server in socket prog
by Corion (Patriarch) on Jun 23, 2016 at 08:42 UTC

    If you want to transfer files over the same connection, you will have to open a file, read blocks from it, send those to the other party.

    If you just want to transfer files and the client and server can speak the SSH protocol, then reusing Net::SSH::Any or Net::SSH2 can work well. Note that one side needs to run an SSH server for that.

    If you just want to transfer files, consider having the server serve the files over HTTP and just transfer the appropriate URL to the client. The client can then use any of the HTTP modules to download the resource.