I have multiple clients connected to a, say, Chatserver. If I recieve a message I forward it to all connected clients. It could happen that no buffer space is available due to the client's bandwith limit. Maybe not for a chatserver but let's assume the messages are really big and there are lots of them. WSASend should return an error that the buffer is full.
My question is, how should I handle such behavior. Shall I store all outgoing messages in a separate buffer until all of them are sent or a specific timeout has occured. If, how would I design that structure?
If the issue is with the bandwidth between the client and the server you should get either a connection timeout or a connection reset error, not a buffer size error. But if you are trying to send something that is too large for the buffer on the clients side then the next set of instructions to the client should tell it how large of a new WSABUF struct to create. What makes you think it's a bandwidth issue?
The key to my problem is flow control. The server will have to wait for the client if its bandwith captacity is exhausted, so winsock, or an underlying layer will have to queue the packets. If that buffer is full, I should get an error message.
The problem is, I do not know what to do here. In my case such congestions happen rarely, and there will be time for the client to "recover".