mgravell / Pipelines.Sockets.Unofficial

.NET managed sockets wrapper using the new "Pipelines" API
Other
400 stars 51 forks source link

Flush data to socket without OnReaderCompleted #41

Open Tragetaschen opened 4 years ago

Tragetaschen commented 4 years ago

I have a SocketConnection and push a fixed amount (say 10 MiB) of data into the PipeWriter to be sent to the client.

In the past, after I had written all my data, I would wait for the OnReaderCompleted "event" before disposing the socketConnection to make sure all bytes in the Pipe have been flushed to the socket. Otherwise, the client would not receive all bytes.

What can I do in .NET Core 3 between writing the last byte and closing the socket?

Tragetaschen commented 4 years ago

Basically I'm looking for something like this: https://github.com/Tragetaschen/Pipelines.Sockets.Unofficial/commit/43b172b53857aa0bfd542108cbe7ec03e3d24a81