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:
- parsing
pasv
response - 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
Post a Comment