DSLua Community
Welcome, Guest. Please login or register.
May 21, 2012, 08:33:07 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  Downloading files in dslua « previous next »
Pages: [1]
Author Topic: Downloading files in dslua  (Read 1198 times)
jepper
New Moon
*
Posts: 2


« on: July 03, 2007, 09:06:59 AM »

Hi

I ve got a question

how do you download a file from the internet that is about 3-4 mb?
i cant find any good lua tutorial covering this :/

My idea is to make a script that gets the mp3 that you want from streaming sites (i made a similar script for xbmc (omplayer) in python)
so your ds is a music player with unlimited storage (you delete the files you listened)

Peace out!

Jasper
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #1 on: July 03, 2007, 12:57:34 PM »

You must be one of Jester's clones.

Notice that your username is jepper and you signed as jasper...

Anyway, onto your question.

DSLua currently has no method of downloading anything larger than ~300 bytes. In fact, almost nobody knows how to do that.

I'd ask DragonMinded or the creator of MoonShell. DragonMinded should know.

Your idea is a good one, but on top of it being hard, the DS Wifi features are quite slow. My 30kbps connection reads only 10kbps on my DS Lite.

Hope I helped.
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
jepper
New Moon
*
Posts: 2


« Reply #2 on: July 03, 2007, 03:39:07 PM »

who's jester?
im not a clone...
My nickname is jepper my real name is jasper (dutch)

the python port for ds isnt really usefull right now so i was looking into other development languages.
Lua seemed pretty easy but i couldnt find any network related examples

So i think i should start learning c++  (moonshell is mixed c and cpp right? )

Mmmh with 30 kbps the playtime is longer than the downloading time Smiley
the sd card only serves as cache, the saving is only optional

peace out

Jasper
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #3 on: July 03, 2007, 06:32:21 PM »

I think you'll have to use Socket functions to do this, instead of Wifi.GetHTTP(). I'll show you how to start the code, but I don't know what things to actually send and receive to get a large file so you'll have to look that information up on the internet. There's a lot of socket tutorials on the internet I think.

Code:
Wifi.ConnectWFC()
Socket = Wifi.InitTCP("www.google.com", 80) -- For the website, don't put http:// and don't put any directories after the site name. You can also use an IP address. 80 is the port.

-- This is the code I'm not sure about:
Socket:Send("Give me the first 64kb of /index.html!")
Socket:Recv(buffer)
file_data = file_data .. buffer
Socket:Send("Give me the second 64kb of /index.html!")
Socket:Recv(buffer)
file_data = file_data .. buffer
-- etc... (a loop is better)

Wifi.Disconnect()
Logged
Pages: [1]
« previous next »
    Jump to: