[Gambas-user] Socket cuts out before full page is read.

Robert Moss the.at.robert at ...626...
Fri Nov 7 16:17:34 CET 2008


i tried using \r\n and nothing positive happened. i got 3440 bytes, 1 more
byte than previously (recount showed 3439 bytes, i forgot the debug header)

  DO WHILE (NOT Eof(ME))  'This crap isnt working
    READ #ME, sBuf, Lof(ME)
    sTotal &= sBuf
    WAIT 1  'I added this line since last message, and after waiting 1
second, i got the error that socket was closed.
  LOOP

Does this look right to you?

POST /process_data.php HTTP/1.0
Host: www.myhost.com
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
Referer: http://www.myhost.com/index.php
Cookie: remember=mycine;
login=mycine%2B9e6c670bf76e9a2c07a9921c56d3532ecacf2ae5;
toolbar=mycine%2BC%2B75a593a34aa5ba8e5e5788b7c899802e;
Content-Type: application/x-www-form-urlencoded
Content-Length: 99

type=process_data&feedset=0&value=red%20apple&table=stuff&criteria=exact&set_price=340&old_price=0



On Fri, Nov 7, 2008 at 6:49 AM, Robert Moss <the.at.robert at ...626...> wrote:

> I end my lines with \n but that is not an issue as the remote server is
> Unix based. I receive part of the page, actually i receive approx 3,465
> bytes.  And the last few bytes are like <div id="b   it doesn't even end
> neatly.
>
>
> On Fri, Nov 7, 2008 at 6:44 AM, Benoit Minisini <
> gambas at ...1...> wrote:
>
>> On vendredi 7 novembre 2008, Robert Moss wrote:
>> > First of all I would like to thank all of you for your efforts ^_^ you
>> have
>> > have been a wonderful ally in learning this new language.
>> >
>> > I am using the socket control to create a local ui to a web interface.
>> > I create a request that looks like:
>> >
>> > GET / HTTP/1.0
>> > Host: www.microsoft.com
>> > User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)
>> >
>> > and when it reads in the data, it cuts out not even half way thru.
>> >
>> > I use this code:
>> >
>> > PRIVATE FUNCTION ConnSend(Data AS String) AS String
>> >   DIM sBuf AS String
>> >   DIM i AS Integer 'counter
>> >   DIM sTotal AS String
>> >
>> >   sBuf = Data
>> >
>> >   ME.Connect(myHTTP.USE_HOST, myHTTP.USE_PORT)  'connects to host:port
>> >   DO WHILE (ME.Status <> 7) AND (ME.Status > 0)
>> >     WAIT 0.1
>> >     INC i
>> >     IF i = 200 THEN
>> >       'Timeout - Bail
>> >       DEBUG "Timeout - waiting for connection"
>> >       MyClose() 'close and quit
>> >       RETURN ""
>> >     END IF
>> >   LOOP
>> >   i = 0 'reset counter
>> >
>> >   IF ME.Status <> 7 THEN
>> >     DEBUG "Error: " & ME.Status
>> >     MyClose()
>> >     RETURN "" 'ensure we don't go on
>> >   END IF
>> >
>> >   WRITE #ME, sBuf, Len(sBuf) 'Writes the get or post headers with
>> cookies
>> > sometimes
>> >
>> >   DO WHILE Lof(ME) = 0
>> >     WAIT 0.1
>> >     INC i
>> >     IF i = 200 THEN
>> >       'Timeout - Bail
>> >       DEBUG "Timeout - Waiting for reply"
>> >       MyClose()
>> >       RETURN "" 'ensure we don't go on
>> >     END IF
>> >
>> >   LOOP
>> >
>> >   DO WHILE (NOT Eof(ME))
>> >     READ #ME, sBuf, Lof(ME)  'I previously just used the standard READ
>> #ME,
>> > sBuf, Lof(ME) by itself, but i thought this might work
>> >     sTotal &= sBuf
>> >   LOOP
>> >
>> >   RETURN sTotal
>> >
>> > END
>> >
>> > Is there anything I can do?
>> >
>> > In the return header, it has
>> >
>> > Connection: Close
>> >
>> > and no mention of Chunk (data sending)
>>
>> Do you end your lines with CR+LF? And not just CR?
>>
>> --
>> Benoit Minisini
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>
>



More information about the User mailing list