DKF
DKF

Reputation: 427

How to manage read / write buffers in a clients / server architecture

I would like to know how to manage read and write buffers in a many clients / one server architecture.

My server is asynchronous.

My exact questions are:

Thank you in advance for your responses,

Flo

Upvotes: 0

Views: 216

Answers (1)

user207421
user207421

Reputation: 310915

Do I need to have one read buffer per client connected, or one for the server globally?

One per client, because you will get partial reads, and you need to keep reading to assemble entire messages: you want all that data in one place, adjacent.

Same question with write buffer.

One per client, because you can get short writes.

If my server wasn't asynchronous, would it change any of the answers?

No.

Upvotes: 1

Related Questions