FTP File upload from Memory in C -


i'm programming embedded software in c (not c++) allows me transfer file ftp (some readings specific hardware does), seems don't know how transfer. code:

    ///pasive connection ftp     sprintf(szbuf, "pasv\r\n");         ftp_sendcmd(szbuf);          if(!ftp_recvresponse())             return false;          if(strncmp(szbuf , "227", 3) != 0)             return false;            sprintf(szbuf, "stor m4.html\r\n");//command allows storage of file in ftp                 ftp_sendcmd(szbuf);                 if(!ftp_recvresponse())                                 return false;                  if(!ftp_recvresponse())                     return false; 

the thing stor uses filename, since custom hardware need way stream bytes specific address in sdram (0x000-0xfff example), wondering if give me little advice creating file, fill information in ftp?

the ftp protocol works 2 distinct connections, control connection , data connection. depending on mode, data connection may initiated either server (active) or client (passive).

the pasv command's (which indicates passive transfers) response contains ip address , port server listening data connections.

the stor command indicates server filename must use store data sent client through data connection.

so, missing here is:

  1. parsing pasv response
  2. opening data connection , sending data on it

there other exchages between client , server, instance coordinate termination of data connection after transfer. protocol described in rfc 959.

without knowing library using it's hard how has implemented.

a step step overview can found here


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -