Computer Science Canada

Net commands, and websites

Author:  jrblast [ Wed May 09, 2007 7:52 pm ]
Post subject:  Net commands, and websites

I've been experimenting with turings Net module lately, and decided to try making a proxy server (Users connect to my computer, then I send them the code that the url generates). The problem is I'm having trouble accessing web sites. I tried using the Net.OpenURLConnection, but that kept crashing turing. So I decided to try a regular connection on port 80. I realize that websites use HTTP which involves the client first sending some information including the path (which is why i have the put : netStream, "GET"... line) but it just says waiting for keyboard input. The IP there is my own, I'm running apache right now so I can test it and my friend says hes getting the same error.
Turing:
var data : char
var netStream := Net.OpenConnection ("99.245.168.25", 80) %Open connection
put : netStream, "GET / HTTP/1.0"   %Tell the server to access the path '/'
if netStream > 0 then   %Ensure a proper connection
    loop            %Get everything
        get : netStream, data
        put data ..
        exit when eof (netStream)
    end loop
end if

Author:  LaZ3R [ Thu May 10, 2007 4:10 pm ]
Post subject:  Re: Net commands, and websites

Yeah... I think part of the problem in there is that the user is trying to get data from your computer which isn't sending anything back.


: