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

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

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

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

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 - NetSample Problem

NetSample Problem

Discuss OrbForms Designer and PocketC Architect

NetSample Problem

Postby parissmith on Mon Mar 10, 2008 12:42 pm

I've been trying out the networking functionallity in PocketC, and PocketC Architect for a little bit now, and I'm having trouble getting it to output what I expect it to. Hopefully somebody can lend me a hand to help me understand what is wrong. I'm completely new to sockets, after a week or so of reading up on them I understand how they work (enough to understand the mechanics behind them), but I'm still confused about how to actually get them to retrieve specific files.
I've looked over the PocketC sample (network.pc), and with a little help figured out that in order to see the HTML file, the "strleft(index, 135)" command needs to be extended to get passed the header. So with that success, I started loading the internet address with various *.txt files, and *.xml files to, but it always gives me some sort of error - I haven't been able to actually see a regular text file and in addition the index.html files that I download don't look like the index.html files that I get when using a web brower and clicking on <View Source>. Is there a reason they would be different?
So when trying to solve the problem, I downloaded the demo of PocketC Architect to look at the sample files, and I was really happly to see that there was a basic rss reader (in NetSample), so I examined it and compiled it, but it failed during execution. The error I got was "Unable to resolve, err = 4666" and when I clicked on the Headline button it gave me a bit of text mentioning that the file is on http://www.cnet.com or something to that effect. I then started putting in various http addresses and files, but I haven't been able to get it to work.
Can somebody please let me know how I can get the network fuctions (through either samples) to output information from a text file (*.txt, *.rss, or anything else), or output a *.html file that would resemble the *.html file I would get by using the <View Source> option in a webbrowser.
Thank you so much for your help!
parissmith
 
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am

Re: NetSample Problem

Postby Percival on Mon Mar 10, 2008 11:45 pm

Hi,

I personally haven't worked with the networking functionality in PocketC or Architect, but this might be useful.

parissmith wrote:I started loading the internet address with various *.txt files, and *.xml files to, but it always gives me some sort of error - I haven't been able to actually see a regular text file and in addition the index.html files that I download don't look like the index.html files that I get when using a web brower and clicking on <View Source>. Is there a reason they would be different?

My first guess would be that you are not processing the http headers correctly. Are you looking for the file which starts after the blank line? Like this:
Code: Select all
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix)  (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Etag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8

::file starts here::

The part after the blank line should then be the content you see when you click on <View Source>

Also, the http server returns a code in its response, in the example above it returned 200 for "OK". You probably also heard of 404 Not Found.
I think the the files you are trying to reach might have returned another code. See this web page for the list of codes http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Hypertext Transfer Protocol on wikipedia would be a good place to start reading about the http protocol. http://en.wikipedia.org/wiki/HTTP

parissmith wrote:I downloaded the demo of PocketC Architect to look at the sample files, and I was really happly to see that there was a basic rss reader (in NetSample), so I examined it and compiled it, but it failed during execution. The error I got was "Unable to resolve, err = 4666"

I tried typing in www.google.com and it works just fine for me :?
error 4666 means netErrDNSTimeout (found that in OrbNetwork.oc). I have no idea what could be wrong here.
Percival
 
Posts: 45
Joined: Sat Jul 19, 2003 10:31 am
Location: Netherlands

Re: NetSample Problem

Postby parissmith on Tue Mar 11, 2008 12:30 pm

Percival,
Thanks so much for the reply. I'll copy the errors that I'm getting
here below:

The error I get when I run NetSample without any modification is:

HTTP/1.1 302 Found
Date: Tue, 11 Mar 2008 00:13:04 GMT
Server: Apache/2.0
Location: http://www.cnet.com/
Content-Length: 204
Content-Type: text/html
charset=iso-8859-1
Connection: close
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <ahref="http://www.cnet.com/">here</a>.</p>
</body></html>

So, I then modified it to have the http address http://www.cnet.com, with
and without changing the file name (because my browser was suggesting
a different file name).

With http://www.google.com/index.html (note that I live in canada, and it
scoots me over to google.ca, even though I specifically plug in
http://www.google.com) I get the same 4666 error and:

HTTP:/1.0 302 Found
Location: http://www.google.ca/index.html
Cache-Control: private
Set-Cookie: PREF=ID= BLAHBLAHBLAH; expires=Thu, 11-Mar-2010 00:22:22
GMT;
path=/; domain=.google.com
Content-Type: text/html
***Then there is some more stuff, and at the end of the file it says:
****
<H1>302 Moved</H1>
The document has moved
<AHREF="http://www/google.ca/index.html">here</A>.
<BODY></HTML>

And following http://www.google.com, I tried http://www.google.ca and get

invalid domain name: index.html -- invalid tldd

And finally, an interesting one that *should* work is for
http://www.orbworks.com/index.html I still get the 4666 error, but then I get:

HTTP/1.1 200 OK
Date: Tue, 11 Mar 2008 BLAHBLAHBLAH
Last-Modified: Tue, 22 May 2007 15:45:31 GMT
ETag: "2d-f07ffcc0"
Accept-Ranges: bytes
Content-Length: 45
Connection: close
Content-Type: text/html

<HTML>
<!-- Nothing to see here.-->
</HTML>

And this is obviously different from what I get in the <View Source>
of my browser.

I've also tried other websites, and also RSS feeds that I subscribe
to, and I haven't been able to get any to line up with what I expect.

Percival, as for the links, thank you very much, I'll look into them today.

In the meantime, if somebody has an example of openning up a *.txt or *.xml file that they know works, I would love to try it out. If I can just get one working the way I expect, I should be able to move on from there - it's just right now I can't get any links to work properly, and I don't understand why...

Thanks again for all your help!
parissmith
 
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am

Re: NetSample Problem

Postby samps on Tue Mar 11, 2008 10:53 pm

I think your problem might stem from various web servers not being quite transparent about which pages are served on which requests. An example would be my webhost, wich requires a path to be added before the URL I want to retrieve, but only when using the Orb sockets. Another example is the rss.com.com which attempts to redirect you to http://www.cnews.com, a manouvre that the Orbforms Network sample is not built to handle.

Try feeding the example with the data to retrieve a forecast from Bureau of Meterologics in Australia. The URL for my area (nice cool change, by the way) is http://www.bom.gov.au/cgi-bin/wrap_fwo.pl?IDS10062.txt, which is entered in bits as such:

Code: Select all
err = net.getHostByName("www.bom.gov.au", &addr);


and

Code: Select all
err = s.sends("GET /cgi-bin/wrap_fwo.pl?IDS10062.txt HTTP/1.0\r\n\r\n");


change the number of bytes that are shown in the headlines field:

Code: Select all
fieldHeadlines.text = strleft(rss, 8192);


compile, and compare it to a "view page source" from your favourite browser and I think we can ascertain that the example code works as intended, just not with rss.com.com because they moved...

Samps
Ubuntu user #82
samps
 
Posts: 143
Joined: Tue Feb 20, 2001 12:33 am
Location: Australia

Re: NetSample Problem

Postby parissmith on Thu Mar 13, 2008 12:25 pm

samps,
:evil:
Robe 29 Fine. Mostly sunny

:evil:
Last Saturday I broke 2 shovels clearing my driveway of snow...
But THANK YOU :D I ran your example and it worked - so now I've got something to work from, and a big thank you also for the possible explaination, I'll keep that in mind.
And for the 4666 error, I figured that out too, and it's just my own issue. I had looked over the code (actually I overlooked the code), but I hadn't noticed the fact that the <Resolve> button has nothing to do with the URL that is hardcoded into the sample. There is a field that lets you put in a URL address and the <Resolve> button get the IP address. I hadn't entered anything into the field ...
Again a big thanks to both you samps and percival, and if anybody else has any more input (techniques, tricks, or work arounds) on making the sample more robust (eg to make it output the same http://www.orbwork.com/index.html as I get from <viewsource>), it would be greatly appreciated.
Best regards!
parissmith
 
Posts: 8
Joined: Thu Jan 04, 2007 10:57 am


Return to OrbForms Designer and PocketC Architect

Who is online

Users browsing this forum: No registered users and 2 guests

cron