[Gambas-user] Trouble writing to Accepted Socket stream

T Lee Davidson t.lee.davidson at gmail.com
Sat Mar 30 18:44:14 CET 2019


On 3/30/19 6:27 AM, Tobias Boege wrote:

> This event is raised when the internal buffers allow more data to be written
> to the socket without blocking the application. But a large Write may still
> block because the buffers were not _that_ empty.
> 

> 
> Yes, you have to kick off the process with an initial Write and then
> subsequent Write events will be raised for you as soon as the socket
> has more capacity to take in your data, for as long as you write more
> data inside each event.
> 
> In an HTTP response it'd make sense to push the HTTP header into the
> stream as an initial write, and then fetch and send the body in small
> chunks, maybe from disk if you serve a static file. That'd be most
> memory-efficient.
> 

> 
> If you're satisfied with the explanation above, I'll try to compose
> a better Socket_Write page, too.
> 

Thank you. I was going to do that, but you explain those concepts better than I could.

I think it is important to understand that the firing of the Write event is indicative of the state of the internal buffers and 
not the readiness status of the connection itself as was my original understanding. Your explanation clarifies that.

One more thing I hope you will include in the documentation where appropriate, is whether or not these internal buffers would be 
affected by Flush.


___
Lee



More information about the User mailing list