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

Username:   Password: 
 RegisterRegister   
 Better OpenURLConnection
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ecliptical




PostPosted: Wed Jan 04, 2006 1:46 pm   Post subject: Better OpenURLConnection

The Net.OpentConnection probably works like this to some degree but I find having control over the HTTP command may give you some more power...anyway this is part of the Online Multiplayer modules i'm making

code:

module gameServer
    export OpenURLConnection
    procedure OpenURLConnection (httpCommand, 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
        if httpCommand="GET" then
        var HEADER : string := "GET /index.html" %HTTP/1.1+ chr (10) + "Host: www..ca"
        %var sendHEADER : string := HEADER + chr (10) + "Accept-Ranges: bytes" + chr (10) + "Connection: close" + chr (10) + chr (10)
        put HEADER
        put : netStream, HEADER
        end if
        loop
            get : netStream, line : 1
            put line ..
        end loop
        Net.CloseConnection (netStream)
    end OpenURLConnection
end gameServer
put "Working"
gameServer.OpenURLConnection ("GET","www.yahoo.com")





[/code]
Sponsor
Sponsor
Sponsor
sponsor
Taur




PostPosted: Wed Jan 04, 2006 5:17 pm   Post subject: (No subject)

Very Happy so are you gonna show us how to submit info and read it in the site too?
ecliptical




PostPosted: Wed Jan 04, 2006 5:52 pm   Post subject: (No subject)

check the tutorial section it's there.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: