Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Netstream not capable of understanding carriage return?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LaZ3R




PostPosted: Wed Apr 16, 2008 9:23 pm   Post subject: Netstream not capable of understanding carriage return?

Me and a friend have been working on a program which essentially allows you to download any file you want from the internet, let it be images, exe's, zip's, html codes, all through turing.

This is supposed to turn into a nicely working proxy which simply redirects the data to a connected client, however, in the mean time, we simply want the full code of the exe's and such to be properly downloaded from the source.


The problem:

Trying to download google's logo from www.google.com is 99% GOOD proper code. The problem comes in when turing hits a carriage return. As soon as turing its a carriage return (chr (13)), it assumes the role of chr (10) instead and ends the transmission of the code and thus causes the file to become corrupt.

Any idea's on how we can make Turing understand what a freaking Carriage Return char is? We tried to edit the Net.tu file and changing the "put, get" to "write, read", however, this creates some sort of issue with the connection for some reason and when trying the program again, the netstream is not present even after trying to open the connection with Google again.

So we've hit a brick wall, and help would be great Sad
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Apr 16, 2008 9:52 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Well if you know that this is the character on the server side (that is, you can read chr(13)), then you can encode it as a different character and send that. Obviously you would have to change it back locally, after data is transmitted.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
LaZ3R




PostPosted: Wed Apr 16, 2008 10:16 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Hmm, how would we encode the char differently so that it wouldn't cause a problem with any of the other 255 char's..?

By the way, we have now got the netstream capable of doing read, write (And wow is it much faster transfer heh).

Carriage returns are in fact recognized by Turing through the netstream, but for some reason, the LAST CR is NOT, and that's when the stream dies out.
jrblast




PostPosted: Wed Apr 16, 2008 10:24 pm   Post subject: Re: Netstream not capable of understanding carriage return?

(I'm the LaZ3R's friend)
The program is meant to download from websites, not our own server. We have no control over the server.
We've fixed most of the problems by modifying the net library to use read and write instead of put and get. We had to change other parts of our code a bit, but now it mostly works. We've now managed to download most of the file, but a few rows of pixels at the bottom seem to be missing.

This is what we've managed to download: http://vaughan.nfshost.com/temp.gif
It's missing exactly 170 bytes from the normal google logo. For some reason, after a certain point, the program just gets stuck on the line that reads netstream Sad Almos there though XD

EDIT: Found a temporary solution. Allows us to receive the entire logo, but then we get some extra data at the end. It gets interpreted fine, but theres an extra 2kb or so of useless data.
Mackie




PostPosted: Thu Apr 17, 2008 6:50 am   Post subject: RE:Netstream not capable of understanding carriage return?

If you get this to work you will be my heroes. The Ocean Browser could finally be finished!
LaZ3R




PostPosted: Thu Apr 17, 2008 11:53 am   Post subject: RE:Netstream not capable of understanding carriage return?

Update! Very Happy

Our code now downloads the images/files to the exact byte and we downloaded the google logo 100% perfect with no corrupted data! Wink

We need to make a change to the code so our client reads the content-length of the information being received since as soon as we reach the end of the file, we are sent some garbage HTML data from the site.

More updates to come as we fix this up Smile
LaZ3R




PostPosted: Thu Apr 17, 2008 12:25 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Update again... something is messed up :p
Mackie




PostPosted: Thu Apr 17, 2008 12:30 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Keep me posted. Also, make it easy to use, I would really liek to implement this in Ocean.
Sponsor
Sponsor
Sponsor
sponsor
LaZ3R




PostPosted: Thu Apr 17, 2008 5:04 pm   Post subject: RE:Netstream not capable of understanding carriage return?

What is Ocean?

Right now, the state we are in is slightly odd. For some odd reason, some pictures we are having no problems downloading, however, other files result in our code trying to read the netStream and just get stuck on that line and constantly wait for some reason.

We shall keep trying Smile

Google is at least nice and makes it work , Yahoo is being evil... gtagaming.com I just tried to dl one of the images and got it just fine Razz

So it's not fully operational just yet but we'll see!
Sean




PostPosted: Thu Apr 17, 2008 5:09 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Ocean is the internet browser that Mackie is making, quite the job he has on his hands.
LaZ3R




PostPosted: Thu Apr 17, 2008 6:49 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Well I understood that much... :p

Any information or progress on it ??
Mackie




PostPosted: Thu Apr 17, 2008 6:54 pm   Post subject: RE:Netstream not capable of understanding carriage return?

In my current unreleased version, it download the page, interprets simple tags. And filters out any (well most) uninterpreted tags. The problem was images. If you could get it working, i could start on it again. Smile
LaZ3R




PostPosted: Sat Apr 19, 2008 10:57 pm   Post subject: RE:Netstream not capable of understanding carriage return?

Ok, so we've run into a big problem Sad

For some odd reason, the contentLength (bytes) of data being sent from different sites are not consistant and debugging this is much harder as a result. Some downloaded files exceed what the actual fle size is, and some don't make it to the full file size at all.

Now we wonder.. :p
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 13 Posts ]
Jump to:   


Style:  
Search: