[Gambas-user] Trouble writing to Accepted Socket stream
Cedron Dawg
cedron at exede.net
Sat Mar 30 01:41:38 CET 2019
It's been a long time since I did HTTP, and not much of it then.
I got it to work by closing the socket right after the write. I don't think that's how you are supposed to do it, but it makes the browser happy.
Testing via telnet show the write happens immediately without the close statement.
Sorry I can't help more, but I'll play around a bit with it.
Perhaps you can ctrl-C a telnet and see if your Gambas disappears too.
----- Original Message -----
From: "T Lee Davidson" <t.lee.davidson at gmail.com>
To: "user" <user at lists.gambas-basic.org>
Sent: Friday, March 29, 2019 8:10:31 PM
Subject: Re: [Gambas-user] Trouble writing to Accepted Socket stream
The issue is not whether or not I am correctly implementing the HTTP protocol. The issue is that the Socket object isn't
correctly writing to the stream.
The Socket doesn't become ready-to-write until AFTER I actually try to write to it. It's as if a Write attempt triggers the
Socket.Write (ready-to-write) event handler. If I then attempt write to the stream in that handler, because it should be ready
to right, it gets stuck in a self-triggering loop.
BTW, "HTTP/1.1 200 OK" & crlf & crlf & "Hello world!" should be sufficient to satisfy the browser. It works with test servers
coded in Python, Golang, and Rust.
___
Lee
On 3/29/19 7:27 PM, Cedron Dawg wrote:
> I don't think you are implementing the HTTP protocol, or I don't see it. I don't remember it that well either, sorry.
>
> To get you started:https://www.w3.org/Protocols/rfc2616/rfc2616-sec1.html
>
> I'm pretty sure the browser is waiting for you to send it a greeting as soon as you recieve the connection.
----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: TcpSimpleServer-0.0.1.tar.gz
Type: application/x-compressed-tar
Size: 5250 bytes
Desc: not available
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20190329/702128e7/attachment.bin>
More information about the User
mailing list