[Gambas-user] Socket cuts out before full page is read.
Robert Moss
the.at.robert at ...626...
Fri Nov 7 14:58:10 CET 2008
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)
More information about the User
mailing list