Netduino home hardware projects downloads community

Jump to content


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.
Photo

File Download Via Ethernet


  • Please log in to reply
9 replies to this topic

#1 newfierich

newfierich

    Member

  • Members
  • PipPip
  • 15 posts

Posted 26 May 2011 - 06:19 PM

Hello all, I am new to the Netduino Plus and have just started to play with its Ethernet capabilities. I am wondering if it is possible to download a full file from an Ethernet connection. Are there any examples of this online?

#2 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 May 2011 - 06:24 PM

Hi newfierich, Sure, you can do this via HTTP like you would any other webpage. You'll get blocks of data in your buffer. The big struggle is what to do with the data as you get it. I'm assuming that you want to write it out to an SD card right away, since you have dozens of KB of RAM, not MBs of RAM...but you could also parse the data for specific messages, etc. Chris

#3 newfierich

newfierich

    Member

  • Members
  • PipPip
  • 15 posts

Posted 26 May 2011 - 06:30 PM

Hi newfierich,

Sure, you can do this via HTTP like you would any other webpage. You'll get blocks of data in your buffer. The big struggle is what to do with the data as you get it. I'm assuming that you want to write it out to an SD card right away, since you have dozens of KB of RAM, not MBs of RAM...but you could also parse the data for specific messages, etc.

Chris


Chris, thanks for your quick response. Reading my original question I see that it was not very clear. I would like to send a file from the sd card on the Netduino Plus to a pc. Are there any examples of this implementation? BTW love the Netduino!

#4 Chris Walker

Chris Walker

    Secret Labs Staff

  • Moderators
  • 7767 posts
  • LocationNew York, NY

Posted 26 May 2011 - 06:53 PM

Hi newfierich,

Chris, thanks for your quick response. Reading my original question I see that it was not very clear. I would like to send a file from the sd card on the Netduino Plus to a pc. Are there any examples of this implementation? BTW love the Netduino!

You should be able to accept a connection via a socket or HttpListener, open up the file as a stream, and then read/write chunks of data until the file is completely sent. You can probably use code from the desktop framework for this...you'll just need to keep memory considerations in mind (and use the "long form" method overloads if necessary).

I know that there are a few "web server" projects in the forums. If you do a bit of searching, you may find code that does exactly what you need already. If not, let us know and we can help give you additional pointers.

Glad that you're enjoying your Netduino, :)

Chris

#5 PhilG

PhilG

    Advanced Member

  • Members
  • PipPipPip
  • 42 posts
  • LocationMaine

Posted 20 October 2011 - 07:48 PM

Chris, thanks for your quick response. Reading my original question I see that it was not very clear. I would like to send a file from the sd card on the Netduino Plus to a pc. Are there any examples of this implementation? BTW love the Netduino!


I am looking to do the same thing. Did you get this working? Do you have code that you would like to share?

#6 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 20 October 2011 - 10:05 PM

If you could wait till the end of the weekend, i will upload my webserver project. With it you can access your Netduino via your browser and I try to build it easy extendable, so that you could code just a little method and be able to access your pins on the netduino through the browser for example. But due to school and work i don't have time to finish it till saturday. Code will be published then =) Greets Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------


#7 baxter

baxter

    Advanced Member

  • Members
  • PipPipPip
  • 415 posts

Posted 21 October 2011 - 03:51 AM

Look at the .Net Framework WebClient Class,

http://msdn.microsof....webclient.aspx

e.g. on the PC,
Using client As WebClient = New WebClient
client.UploadFile(SDFullPath, LocalFullPath)
'and 
'client.DownloadFile(SDFullPath, LocalFullPath)
End Using

It's really simple on the PC, but you need to parse the HTTP POST and GET headers on the Netduino and write some code to
handle the file. I am using this method on my PC Netduino client.

Baxter

#8 jgibb311

jgibb311

    New Member

  • Members
  • Pip
  • 3 posts

Posted 25 October 2011 - 06:49 PM

I'm very interested in this topic, as I'm having almost the same issues myself. To be exact, we have successfully created the file on the storage card using FileStream and StreamWrite but we are having difficulty transferring the file (or even just the file contents) from the NetDuino Plus to a PC. Sometimes it's beneficial to tell our target end result because this may trigger something else for someone attempting to help: We are wanting to import this files contents into an Access database that will be displayed for review on the web. We have the database working with a sample text file right now, however, we cannot figure out how to get the contents on the storage card exported over to something the access database can have access to.

#9 tel001

tel001

    Member

  • Members
  • PipPip
  • 13 posts
  • LocationVancouver BC

Posted 29 October 2011 - 07:26 AM

If you could wait till the end of the weekend, i will upload my webserver project.
With it you can access your Netduino via your browser and I try to build it easy extendable, so that you could code just a little method and be able to access your pins on the netduino through the browser for example.
But due to school and work i don't have time to finish it till saturday. Code will be published then =)

Greets Markus


Hi Markus,
I would greatly appreciate a look at your webserver code... It's helpfull guys like you thank get us old guys hooked on new toys :rolleyes:

#10 NeonMika / Markus VV.

NeonMika / Markus VV.

    Advanced Member

  • Members
  • PipPipPip
  • 209 posts
  • LocationUpper Austria

Posted 29 October 2011 - 01:36 PM

Hi Markus,
I would greatly appreciate a look at your webserver code... It's helpfull guys like you thank get us old guys hooked on new toys :rolleyes:


Yeah, I'm working on it. :P
I developed an PC version and just finnished porting it to .NETMF. But I'm facing a problem at the moment (http://forums.netdui...9959#entry19959)
When it's finnished i will post a link to codeplex where you can download the full source.
I will message you via PM if you want. :)

Greets Markus

NeonMika.Webserver
> Control your N+ and write webservice methods easyily
> Receive data from you N+ (in XML or JSON)
> Browse the SD on your N+ directly in the browser and d
own - and upload files

 

If you need help with NeonMika.Webserver, please just leave a note in the thread and/or contact me via Skype :)

 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
--- Mistakes teach you important lessons. Every time you make one, you are one step closer to your goal. ----
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.