The Netduino forums have been replaced by new forums at community.wildernesslabs.co.
This site has been preserved for archival purposes only
and the ability to make new accounts or posts has been turned off.
I have managed to modify Jair's (Thanks Jair ) FTP socket code (from here: http://forums.netdui...-client-socket/) so that I am now able to use it with a wifi connection (Netduino Plus 2 and RN-XV module).
The question I have is how to upload a file from the SD card? At the moment the code simply creates a blank .txt file on the FTP server, how do upload a whole file?
I think FTP would be a problem with the wifly solution; FTP requires a command and data connection; the wifly module can only support 1 connection at the time
Stefan is right on the mark. You'll need both a client and upload socket for FTP to work so WiFly will be hard to do. I've just started looking into FTP for Pandora's Box as a means for getting the files of the SD card without removing the card but I haven't started programming yet as the Prototype is out for field tests this week. If I make any progress on it over the weekend I'll post up.
I suppose the reason I was able to see an empty test text file on my FTP server was a result of the CMD connection working fine but obviously without the second connection there's no way to move the SD card's file to the server.
This was one of my last hopes to get this project off the ground as using an HTTP request for my live data logger isn't ideal either (As detailed here: http://forums.netdui...75-memory-leak/).
I've been working on this project for months now and am out of ideas about how to make it work
Since I'm not sure what exactly you are doing with your project and how you are triggering the FTP transaction, this suggestion may be worthless, but how about using the single connection as the upload only and have the ND FTP the files to a file server with another type of trigger (ie: Menu system on the ND, or Timer, or Schedule, etc.)? I think I read somewhere you can do this with WiFly you just can't do an full FTP server implementation.
I'm trying to build a data logger which uses a photo sensor to count actions (I've already got this working as well as writing the count to an LCD).
Basically every time the sensor beam is broken I have an On_interrupt increase a counter variable by one and then write the count and datetime stamp to a new line in a text file on the SD card.
I was then going to have a timer upload that file to my server every 5 minutes(for example). Once the file is uploaded I'll send an HTTP request to a .NET page which will in turn read the text file (on the server) and write the count values into an SQL DB.
So simply:
Main function{ connect to wifi wait for interrupt}On_interrupt{ increase counter by 1 write count/dateTime to the SD card text file trigger 5 minute timer to start upload (if timer not already running)}Upload{ upload file to FTP server empty file for new values send HTTP request to read file on server reset timer}
Because I'm only looking to send the file up to the FTP server (no download or anything else from the server) I thought that a single connection wold be fine? The Wifi isn't doing anything else at the same time.
And the reason we'd like to use wifi is so that we can place the sensor/netduino anywhere without having to worry about cabling back to a router. We'd like to use it in a factory on a press to count components as they come out of the machine.
Thanks for any help!
Regards,
Donovan
P.S. I did originally have it setup so that on the interrupt an HTTP request was sent with the count and datetime (as querystring variables) but this caused issues with timeouts and such and also was a problem if the wifi connection was dropped. The other issue is that, depending on the press tool which is running, the machine can churn out over 60 items a minute... that's FAR too many HTTP requests to try and send and would result in the whole thing falling over.
Sorry if I'm over simplifying this.
I'm new to hardware development, but have built lots of sftp applications in the past as console apps, why don't you have one thread logging the data into various files on the sd card, and have another watching that directory for new files to process every 5 minutes.
use the method you used or originally but have it parse and upload the file contents, when successful delete or rename the file so it isn't processed again and set a time out for the http request about 10 secs, this way if the timeout occurs the time out doesn't hold up data logging. Then when you have no Wifi, nothing is lost and will be uploaded as the Wifi connection is reestablished.
According to the WiFly User Manual, the WiFly module supports FTP out of the box. Is that not the case?
Looks like you basically set up an ftp connection using the "set ftp *" commands, and then wait for a connection. They probably use PASV transfers so they only need one connection.
I'm going to be needing this functionality for my project so I had planned on adding support for it to the WiFlyGSX class at some point. If I'm wrong and it doesn't support it, I'm really screwed...
According to the WiFly User Manual, the WiFly module supports FTP out of the box. Is that not the case?
Looks like you basically set up an ftp connection using the "set ftp *" commands, and then wait for a connection. They probably use PASV transfers so they only need one connection.
I'm going to be needing this functionality for my project so I had planned on adding support for it to the WiFlyGSX class at some point. If I'm wrong and it doesn't support it, I'm really screwed...
nah, you can always code around that FTP limitation using HTTP
The problem is I don't know how to get the wifi SimpleSocket to upload the file via FTP. I already have a routine which alternates between two files so that one file is the "live" file which is having the counts stored on it and the other is the "upload" file. Once the "upload" file has been uploaded it's emptied and becomes the "live" file and the old "live" file waits in the queue for it's turn to be uploaded.
The problem is getting the files FTP'd up to the server. And HTTP is not an option because of the memory leak issue I detailed here: http://forums.netdui...75-memory-leak/
And as I mentioned there could be as many as 60 counts a minute, which would mean 60 HTTP requests a minute and these machines run in 8 hour shifts... so that's 28 800 HTTP requests per machine and we're hoping to have about 20 machines using these Netduino counters. This is why I'd like to use FTP to get the data to the server and then simply have a script on the server process the text file.
Hi Eric,
According to the WiFly User Manual, the WiFly module supports FTP out of the box. Is that not the case?
This is true and I have used CoolTerm to connect to the wifi module via a UartBee sheild and in CMD mode I have been able to contact the Roving Networks FTP server and download a firmware update for the RN-XV.
The problem is that I don't know how you'd go about accessing CMD mode with the wifi module on the netduino board or even if the two will even talk to each other then.
There has to be a way to use simpleSocket to upload a file via FTP? I have been able to successfully connect to my FTP server and create an empty text file on the server (using the code in my first post on this thread) so surely that's half the battle won?
I'm hoping that Dave is onto something and we can simply use the single connection as the data connection and have one way FTP. I have no need for a full FTP server implementation at this stage and simply want to get those data files off the netduino and onto the server.
I don't have a WiFly Module to test this for you and don't have a WiFly help guide but I agree you are half way there. I responded on your memory leak thread post. Just throwing a few ideas out there. Let me know if it helps.
What you are trying to accomplish reminded me of an MSDN Magazine article I read. They are doing something similar with regular HTTP request and response objects each second. I found the article online (the link above. )
how about using the single connection as the upload only and have the ND FTP the files to a file server with another type of trigger (ie: Menu system on the ND, or Timer, or Schedule, etc.)? I think I read somewhere you can do this with WiFly you just can't do an full FTP server implementation.
Unfortunately it's not something I have time to play with. I don't use WiFly in any of my projects and most of the products I'm designing now use an HTTP server for file transfer since there are other HTTP functions that I need also.
I never knew you could use HTTP for file transfer; I'll look into this over wifi and report back any findings.
Thanks for the lead!
It's just like uploading and downloading files from a website. I'm using the NeonMika Webserver running on my Netduino+ because I'm also transferring data using JSON and allowing some web access to Pandora's Box for easy configuration.