Computer Science Canada

Custome Net.OpenURLConnection

Author:  ecliptical [ Wed Jan 04, 2006 12:19 am ]
Post subject:  Custome Net.OpenURLConnection

Ok there are a few problems with the current Net.OpenURLConnection the main one being you CAN'T send your own HTTP commands (PUT,GET,OPTION..etc) i suspect this might be some sort of security feature since you could potentially make some nasty things anyway I'll assume you're responsible people.

code:
module gameServer
    export OpenURLConnection
    procedure OpenURLConnection (url : string)
        var line : string (1)
        var netStream : int
        netStream := Net.OpenConnection (url, 80)
        if netStream <= 0 then
            put "Unable to connect to ", url
            return
        end if
        var HEADER : string := "GET /index.html "
        put : netStream, HEADER
        loop
            get : netStream, line : 1
            delay (10)
            put line ..
        end loop
        Net.CloseConnection (netStream)
    end OpenURLConnection
end gameServer
put "Working"
gameServer.OpenURLConnection ("http://www.yahoo.com")

This still needs improvements but it seems to work =)

Author:  MovieTheatre [ Thu Feb 09, 2006 6:27 pm ]
Post subject: 

hmmmm
let c
look like a nice program made by CompSci Member

hehe
thanks


: