05-05-2010 08:53 AM
hi,
when i was trying with InetFTPGetDir() InetFTPGetDirList function i am getting System socket error, i tried with the sample program ftpclt.cws as mentioned in one of the thread, even though i am getting same socket error. dont know wr the probelm is..... pls help me to get this done.
05-05-2010 10:10 AM
In one of your previous posts, you mentioned the successful use of the InetFTPAutoReceive() function. As this function needs the same parameters as your InetFTPLogin() function, to get a handle for InetFTPGetDirList(), it is difficult to tell what is wrong, unless there is an error in your code. What exactly does the error message say? Can you post some of your code for us to have a look at?
JR
05-06-2010 01:44 AM
herby my sample code. i am getting system socket error in InetFTPGetDir().if i call InetFTPGetDirList() i am reading the folder names inside the current directory.but in my case by default my ftp server has some 5 folder and i need to read the files available inside any of the folder say "reports/" folder as shown in the attachment picture.so how can i read the files name inside the folder "ftp://10.105.148.139/reports/".
int CVICALLBACK getftpfiles (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { char ipaddr[100],uname[50],paswd[50]; switch (event) { case EVENT_COMMIT: GetCtrlVal(panelHandle,PANEL_STRING,ipaddr); GetCtrlVal(panelHandle,PANEL_STRING_2,uname); GetCtrlVal(panelHandle,PANEL_STRING_3,paswd); ftphandle = InetFTPLoginEx(ipaddr,uname,paswd,6000); error = InetFTPSetPassiveMode (ftphandle, 1); if(error<0) Error (error); getfilesfromFTP(); break; } return 0; } void getfilesfromFTP(void) { char dir[MAX_PATHNAME_LEN]; char ftp_dir[MAX_PATHNAME_LEN]; char **files = NULL; int num; error = InetFTPGetDir(ftphandle,dir,MAX_PATHNAME_LEN); /*here i am getting system socket error*/ if(error <0) Error (error); error = InetFTPGetDirList (ftphandle, &files, &num); /*here i am getting system socket error*/ if(error<0) Error(error); Fmt(ftp_dir,"%sreports/",dir); InetFTPChangeDir(ftphandle,ftp_dir); /*change FTP dir to ftp://10.105.148.139/reports/ */ /* now i need to get the file name available inside reports folder ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ ----------------------------------------------------------------------------*/ error = InetFTPClose(ftpHandle); if(error<0) Error(error); }
05-06-2010 02:17 AM
05-06-2010 02:55 AM
05-06-2010 05:00 AM
finally i got the solution by having InetFTPGetDirList () function to retrive files from remote to local
thanks a lot for JR & Wolfgang
05-06-2010 05:05 AM
Would you mind to tell us what the reason was? Might be interesting for other users, too.
05-06-2010 06:51 AM
Initally i thought of getting dir name through InetFTPGetDir() and changing the directory with "reports" folder through InetFTPChangeDir() and getting number of files avilable in changed directory through InetFTPGetDirList. when i started with InetFTPGetDir() it keeps on showing system socket error so that i could not able to move to next step in which other 2 funcitons also shows the same error.
i commented InetFTPGetDir() and started calling InetFTPChangeDir(ftphandle,"reports") and getting the files available in that dir. it reads well.....
i got stuck up with the system socket error in InetFTPGetDir() if i remove that line my code is working fine. All this functions is called after successful FTP login.