I'm finally getting around to trying out the PowerBASIC TCP capabilities - and wouldn't you know that one of the first examples I try (Help Topic TCP Open) doesn't work.
The example code, even corrected for valid Site$/File$ values (the File$ in the example does not exist) I still get an error from the server:
Does anyone have a corrected version? (I sent Support a note, but thought I'd see if anyone was still up tonight in the forums that has had/and resolved the problem).
... two hours later ...
now when I run the example from Help, it works fine and I can see the page from the PowerBASIC web site.
But a page from my web site does not work - as before, giving the same error message.
I'm not quite sure what's happening. The PB server might have been down, and now it's up. But my own server has been up the whole time and I can manually see the page.
The example code, even corrected for valid Site$/File$ values (the File$ in the example does not exist) I still get an error from the server:
Your browser sent a request this server could not understand.
Code:
' Client TCP/IP example - retrieve a web page #COMPILE EXE FUNCTION PBMAIN() AS LONG LOCAL Buffer$, Site$ LOCAL Entire_page$, Htmlfile$, Link$ LOCAL Pos&, Length& Site$ = "www.powerbasic.com" File$ = "http://www.powerbasic.com/support/forums/Forum2/HTML/000031.html" ' Connecting... TCP OPEN "http" AT Site$ AS #1 TIMEOUT 60000 ' Could we connect to site? IF ERR THEN BEEP EXIT FUNCTION END IF ' Send the GET request... TCP PRINT #1, "GET " & File$ & " HTTP/1.0" TCP PRINT #1, "Referer: http://www.powerbasic.com/" TCP PRINT #1, "User-Agent: TCP OPEN Example (www.powerbasic.com) TCP PRINT #1, "" ' Retrieve the page... DO TCP RECV #1, 4096, Buffer$ Entire_page = Entire_page + Buffer$ LOOP WHILE ISTRUE LEN(Buffer$) AND ISFALSE ERR ' Close the TCP/IP port... TCP CLOSE #1 END FUNCTION
now when I run the example from Help, it works fine and I can see the page from the PowerBASIC web site.
But a page from my web site does not work - as before, giving the same error message.
Site$ = "www.garybeene.com"
File$ = "http://www.garybeene.com/files/gbsnippets.msg"
File$ = "http://www.garybeene.com/files/gbsnippets.msg"
Comment