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

Robert Moss the.at.robert at ...626...
Fri Nov 7 15:49:38 CET 2008


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