LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Use DataSocket to transfer files via FTP

I need to transfer files in text form to a device via an ethernet. I have a basic structure attempting to do this. It reports DS_GetLastError "Download Complete" or "Can't Open File". But no data is returned.
0 Kudos
Message 1 of 6
(4,138 Views)
Hello

Does the server require any form of authentication? If it does, make sure you built up the URl correctly.Check out the following link for that. Also see if the Open returns any errors and whether you are able to connect correctly to another ftp server. Check the logs of the ftp server to see if any connection attempt was made.

If you have a code snippet, you can post it here. I didnt run into problems with this.

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 6
(4,138 Views)
Bilal Durrani,

Thank you for your response.

I have read and appied the KnowledgeBase "Retrieve Data from FTP Servers that require Username and Password.
0 Kudos
Message 3 of 6
(4,138 Views)
Hmmm, I tested some text files out on out ftp that allows for anonymous login and read the contents of the text file in the following way:

status = DS_OpenEx ("ftp://ftp.ni.com/outgoing/test.txt[text]", DSConst_Read, NULL, NULL, DSConst_EventModel, 5000, &dsHandle);

Delay(1);

status = DS_GetDataType (dsHandle, &type, &dim1, &dim2);

status = DS_GetDataValue (dsHandle, CAVT_CSTRING, data, 10, NULL, NULL);

It seemed to work ok.

Try reading it from there and see if you get anything. If you can, try to setup the ftp server to allow anonymous logins, temporarily, just to test whether its the password or not.
And try adding delays as well, and see if that changes anything.

Bilal
Bilal Durrani
NI
0 Kudos
Message 4 of 6
(4,138 Views)
Bilal,

Thank You for your prompt and very useful response. After few attempts it does indeed print to a TextBox "test for FTP transfer". The status
is "Idle Download Complete". I am very pleased with that result.
That confirms that the overall Data Socket process can read over an ethernet connection. That is excellent. Once it can read, the ability to write can be realized. I appreciate your help.
I will let you know when the final process is working.
Dave CT
0 Kudos
Message 5 of 6
(4,138 Views)
Bilal
The Process is now able to read from the intended
camera. Two different files display as expected.
Thank You very much.
Dave Ct
0 Kudos
Message 6 of 6
(4,138 Views)