Loading ...
Sorry, an error occurred while loading the content.

open socket

Expand Messages
  • marcelkavka
    Hi folks! I m fighting hard battles against the open socket:www.... - function. My little sample: 10 open socket:www.yahoo.com ,80 for input as #1 20 open
    Message 1 of 5 , Jun 30, 2005
    • 0 Attachment
      Hi folks!

      I'm fighting hard battles against the "open socket:www...." - function.
      My little sample:

      10 open "socket:www.yahoo.com",80 for input as #1
      20 open "socket:www.yahoo.com",80 for output as #2
      30 print #2,"soft"
      65 for i = 1 to 200
      70 input #1,a$
      80 print i,a$
      90 next i
      100 close #1 : close #2
      110 end

      prints empty lines. (with the i-count ahead) I even get more trouble
      if I place an adress like www.yahoo.com/index.html. This shows "File
      not found in 10". Seem to be two different problems. Maybe my
      wlan-router causes all this???
      thanks for any help!!

      (ibook, 10.3.9)

      marcel
    • rhnlogic
      When using sockets, you have to correctly format an HTTP request as per the RFC. 100 rem Chipmunk Basic HTTP(web page) via socket example 110 host$ =
      Message 2 of 5 , Jul 15, 2005
      • 0 Attachment
        When using sockets, you have to correctly format an HTTP request as
        per the RFC.

        100 rem Chipmunk Basic HTTP(web page) via socket example
        110 host$ = "www.nicholson.com"
        120 url$ = "/rhn/basic/index.html"
        130 s$ = "socket:" + host$
        140 p = 80 : rem port 80 for HTTP
        160 open s$, p for input as #1
        180 open s$, p for output as #2 : rem - open the socket
        190 rem
        200 h$ = "HEAD " : rem Command to read status, info and size
        202 rem h$ = "GET " : rem Use this command to read the html text
        204 rem
        210 rem URL goes in HTTP command
        220 h$ = h$ + url$ + " HTTP/1.0"
        240 print #2, h$ + chr$(13)
        250 h2$ = "Host: www.nicholson.com"
        260 print #2, h2$ + chr$(13)
        270 h3$ = "Connection: close"
        280 print #2, h3$ + chr$(13)
        290 print #2, chr$(13)
        300 for i = 1 to 1000
        310 if eof then goto 420
        320 input #1,a$ : rem - Read web page or status
        340 print i, a$ : rem - Echo result
        380 next i
        420 close #1 : close #2
        490 bye
        990 end

        --- In chipmunkbasicforum@yahoogroups.com, "marcelkavka"
        <mspisak@g...> wrote:
        > Hi folks!
        >
        > I'm fighting hard battles against the "open socket:www...." - function.
        > My little sample:
        >
        > 10 open "socket:www.yahoo.com",80 for input as #1
        > 20 open "socket:www.yahoo.com",80 for output as #2
        > 30 print #2,"soft"
        > 65 for i = 1 to 200
        > 70 input #1,a$
        > 80 print i,a$
        > 90 next i
        > 100 close #1 : close #2
        > 110 end
        >
        > prints empty lines. (with the i-count ahead) I even get more trouble
        > if I place an adress like www.yahoo.com/index.html. This shows "File
        > not found in 10". Seem to be two different problems. Maybe my
        > wlan-router causes all this???
        > thanks for any help!!
        >
        > (ibook, 10.3.9)
        >
        > marcel
      • Jeremy Gardiner
        I get Syntax error, missing symbol in line 160 ... should this work on a Mac? I have Chipmunk BASIC v3.5.7b1. Jeremy Gardiner From: rhnlogic
        Message 3 of 5 , Jul 16, 2005
        • 0 Attachment
          I get "Syntax error, missing symbol in line 160" ... should this work on a
          Mac?

          I have Chipmunk BASIC v3.5.7b1.

          Jeremy Gardiner

          From: "rhnlogic" <rhnlogic@...>
          Reply-To: chipmunkbasicforum@yahoogroups.com
          Date: Fri, 15 Jul 2005 18:14:55 -0000
          To: chipmunkbasicforum@yahoogroups.com
          Subject: [Chipmunk Basic Forum] Re: open socket

          When using sockets, you have to correctly format an HTTP request as
          per the RFC.

          100 rem Chipmunk Basic HTTP(web page) via socket example
          110 host$ = "www.nicholson.com"
          120 url$ = "/rhn/basic/index.html"
          130 s$ = "socket:" + host$
          140 p = 80 : rem port 80 for HTTP
          160 open s$, p for input as #1
          180 open s$, p for output as #2 : rem - open the socket
          190 rem
          200 h$ = "HEAD " : rem Command to read status, info and size
          202 rem h$ = "GET " : rem Use this command to read the html text
          204 rem
          210 rem URL goes in HTTP command
          220 h$ = h$ + url$ + " HTTP/1.0"
          240 print #2, h$ + chr$(13)
          250 h2$ = "Host: www.nicholson.com"
          260 print #2, h2$ + chr$(13)
          270 h3$ = "Connection: close"
          280 print #2, h3$ + chr$(13)
          290 print #2, chr$(13)
          300 for i = 1 to 1000
          310 if eof then goto 420
          320 input #1,a$ : rem - Read web page or status
          340 print i, a$ : rem - Echo result
          380 next i
          420 close #1 : close #2
          490 bye
          990 end



          [Non-text portions of this message have been removed]
        • hotpaw2
          The current version of Chipmunk Basic for Mac OS X is 3.6.2 You can download it from here: http://www.nicholson.com/rhn/basic/ Network sockets, as per the
          Message 4 of 5 , Jul 16, 2005
          • 0 Attachment
            The current version of Chipmunk Basic for Mac OS X is 3.6.2
            You can download it from here: http://www.nicholson.com/rhn/basic/

            Network sockets, as per the example below, do work with 3.6.2 under
            OS X and under linux. (the Mac OS 9 Classic and win32 builds don't
            have any network functionality that's been tested IIRC.)

            --- In chipmunkbasicforum@yahoogroups.com, Jeremy Gardiner
            <jeremy.gardiner@b...> wrote:
            > I get "Syntax error, missing symbol in line 160" ... should this work on a
            > Mac?
            >
            > I have Chipmunk BASIC v3.5.7b1.
            >
            > Jeremy Gardiner
            >
            > From: "rhnlogic" <rhnlogic@y...>
            > Reply-To: chipmunkbasicforum@yahoogroups.com
            > Date: Fri, 15 Jul 2005 18:14:55 -0000
            > To: chipmunkbasicforum@yahoogroups.com
            > Subject: [Chipmunk Basic Forum] Re: open socket
            >
            > When using sockets, you have to correctly format an HTTP request as
            > per the RFC.
            >
            > 100 rem Chipmunk Basic HTTP(web page) via socket example
            > 110 host$ = "www.nicholson.com"
            > 120 url$ = "/rhn/basic/index.html"
            > 130 s$ = "socket:" + host$
            > 140 p = 80 : rem port 80 for HTTP
            > 160 open s$, p for input as #1
            > 180 open s$, p for output as #2 : rem - open the socket
            > 190 rem
            > 200 h$ = "HEAD " : rem Command to read status, info and size
            > 202 rem h$ = "GET " : rem Use this command to read the html text
            > 204 rem
            > 210 rem URL goes in HTTP command
            > 220 h$ = h$ + url$ + " HTTP/1.0"
            > 240 print #2, h$ + chr$(13)
            > 250 h2$ = "Host: www.nicholson.com"
            > 260 print #2, h2$ + chr$(13)
            > 270 h3$ = "Connection: close"
            > 280 print #2, h3$ + chr$(13)
            > 290 print #2, chr$(13)
            > 300 for i = 1 to 1000
            > 310 if eof then goto 420
            > 320 input #1,a$ : rem - Read web page or status
            > 340 print i, a$ : rem - Echo result
            > 380 next i
            > 420 close #1 : close #2
            > 490 bye
            > 990 end
            >
            >
            >
            > [Non-text portions of this message have been removed]
          • Jeremy Gardiner
            That explains it - I have Mac OS 8.5.1 ... From: hotpaw2 Reply-To: chipmunkbasicforum@yahoogroups.com Date: Sat, 16 Jul 2005
            Message 5 of 5 , Jul 17, 2005
            • 0 Attachment
              That explains it - I have Mac OS 8.5.1 ...

              From: hotpaw2 <no_reply@yahoogroups.com>
              Reply-To: chipmunkbasicforum@yahoogroups.com
              Date: Sat, 16 Jul 2005 18:51:29 -0000
              To: chipmunkbasicforum@yahoogroups.com
              Subject: [Chipmunk Basic Forum] Re: open socket

              The current version of Chipmunk Basic for Mac OS X is 3.6.2
              You can download it from here: http://www.nicholson.com/rhn/basic/

              Network sockets, as per the example below, do work with 3.6.2 under
              OS X and under linux. (the Mac OS 9 Classic and win32 builds don't
              have any network functionality that's been tested IIRC.)

              --- In chipmunkbasicforum@yahoogroups.com, Jeremy Gardiner
              <jeremy.gardiner@b...> wrote:
              > I get "Syntax error, missing symbol in line 160"
              > should this work on a Mac?



              [Non-text portions of this message have been removed]
            Your message has been successfully submitted and would be delivered to recipients shortly.