Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 112
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Using the Network functions to download files

Using the Network functions to download files

Discuss PocketC for Palm OS (including Desktop Edition)

Using the Network functions to download files

Postby parissmith on Thu Feb 28, 2008 3:43 pm

I'm just starting to play around with the network function in PocketC, and I'm interested in being able to download files from the internet (or network) using those functions.
Can anybody provide some sample code on either:
1) Reading in a text file (for example index.html)
2) Some routines on pulling an entire file from a server, and saving it to the SD card using the VFS functions.
Code for either would be great, but at least 1) would get me going.
Thanks for all your help!
parissmith
 
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am

Re: Using the Network functions to download files

Postby dewey on Sat Mar 01, 2008 8:24 am

PocketC includes a sample for doing number 1. It is inlcuded in the PocketC zip file (or PDE installer), and will show up in samples\network.pc. There is also a sample for using VFS, but it doesn't specifically show file writing. However, it should get you started.
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Re: Using the Network functions to download files

Postby parissmith on Mon Mar 03, 2008 1:16 pm

Dewey,
Thanks for the reply! Please pardon my ignorance, I had already played around with the sample file and it doesn't do what I would have expected.
When I run it, it outputs a few dozen words giving me information about the server, time, and other details. Given that the send command says "GET /index.html ..." I would expect to see it read off the index.html file which would be along the lines of:

<html>
<head>
<title>
OrbWorks Concentrated Software</title>
<META NAME="Keywords" CONTENT="palm programming tool mobile application pda programming app orb
...


Can you help me understand what I'm seeing? Or if you could simply provide me a link to a socket tutorial that would explain it in simple terms, that would be really helpful!

Again, thank you for taking the time to help me out!
parissmith
 
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am

Re: Using the Network functions to download files

Postby dewey on Tue Mar 04, 2008 6:02 am

The sample is sending an HTTP request and getting an HTTP response. So the "server information" and whatnot are the HTTP headers. The actual file begins after the first empty line (denoting the end of the headers).
dewey
Site Admin
 
Posts: 749
Joined: Sun Oct 21, 2007 5:12 am

Re: Using the Network functions to download files

Postby parissmith on Tue Mar 04, 2008 1:03 pm

dewey,
Thanks for the help. That makes so much sense now!
Cheers
parissmith
 
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 5 guests

cron