Announcement

Collapse
No announcement yet.

TCP Open Example Code in Help Does Not Work

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graham McPhee
    replied
    You wouldn't know which setting they changed as I'm having the same problem with my own Abyss web site?
    Last edited by Graham McPhee; 19 Oct 2009, 04:15 PM.

    Leave a comment:


  • Gary Beene
    replied
    Solution found.

    My ISP folks changed a mod_security setting, which seems to do the trick. The Help example now works with pages/files from my site.

    Leave a comment:


  • Mike Stefanik
    replied
    Just as an aside, you should typically not be specifying the referer header like that example is doing. It would tell any and all webservers that the request to them originated from the PowerBasic website, which is obviously not correct. You'd also typically want to change the User-Agent header value as well. And yes, it's not necessary to specify a complete URL as the resource. It could simply be defined as "/path/to/some/file.html" instead.

    Leave a comment:


  • Gary Beene
    replied
    Mike, thanks for the response.

    I also heard from Steve at PB Inc.

    True, this does not work for your site, but works for all other sites
    He also had trouble reaching my site with the code. You, him, me - all the same negative results in reaching my site. I'll send my ISP a note asking for help.

    BTW, the full URL or the version without the leading "http://.../" seems to work fine with File$ - just like the Help example.

    Leave a comment:


  • Mike Doty
    replied
    File$ = "/support/forums/Forum2/HTML/000031.html"

    Trying to find this page on your server did not work.
    fname = "/sw/gbsnippets.htm
    Last edited by Mike Doty; 30 Sep 2009, 02:21 AM.

    Leave a comment:


  • Gary Beene
    started a topic TCP Open Example Code in Help Does Not Work

    TCP Open Example Code in Help Does Not Work

    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:

    Your browser sent a request this server could not understand.
    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).

    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
    ... 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.

    Site$ = "www.garybeene.com"
    File$ = "http://www.garybeene.com/files/gbsnippets.msg"
    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.
    Last edited by Gary Beene; 29 Sep 2009, 11:19 PM.
Working...
X
😀
🥰
🤢
😎
😡
👍
👎