I want asynchronous res->write(), or maybe it is? #1839
rafalwijata
started this conversation in
General
Replies: 1 comment
-
You want onWritable and tryEnd
Den lör 1 feb. 2025 kl 12:21 skrev Rafal W ***@***.***>:
… c++.
I'm trying to implement asynchronous server.
As I understand if I register res->onData() I'll be async called when some
data is available until last chunk.
That looks fine and i believe it's fully async.
However I'm concern about writing answer.
There's no function like async_write() with callback when data is written.
res->write() seems synchronous.
res->onWritable() does not guarantee that calling res->write() from within
it will success (and still is synchronous, right?).
Moreover I'm confused about res->write() return value. Does res->write()
is atomic, that is it either writes all or nothing?
And I hope res->write() will not copy any data to some internal buffers
but directly to socket, it would be extra copy and performance impact.
Please bear with me and please explain how to write fully asynchronously.
—
Reply to this email directly, view it on GitHub
<#1839>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/A2NMOMNFU3SGDE5IO4I4YWT2NSUZ3AVCNFSM6AAAAABWJGBXZ6VHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXHEYDAMZRGA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
c++.
I'm trying to implement asynchronous server.
As I understand if I register res->onData() I'll be async called when some data is available until last chunk.
That looks fine and i believe it's fully async.
However I'm concern about writing answer.
There's no function like async_write() with callback when data is written.
res->write() seems synchronous.
res->onWritable() does not guarantee that calling res->write() from within it will success (and still is synchronous, right?).
Moreover I'm confused about res->write() return value. Does res->write() is atomic, that is it either writes all or nothing?
And I hope res->write() will not copy any data to some internal buffers but directly to socket, it would be extra copy and performance impact.
Please bear with me and please explain how to write fully asynchronously.
Beta Was this translation helpful? Give feedback.
All reactions