acarrillo/Cribble — Issue #7: Server Implementation
Author: DoronShapiro
Created: 2012-01-15 04:30:11+00:00
State: open

Mostly notes to myself for tomorrow after debugging the server today:

Here is the final behavior that we need from the server:
1. Clients connect and are "remembered" by the server
2. Clients constantly send data up to the server
3. The server send all of the data it receives to all of the clients (in a uniform order)

So basically, we're creating a broadcast server.
Right now, when each new client joins, it receives a socket file descriptor in the server. The current plan is for the server to constantly loop through its list of socket descriptors, and if any have written a data struct, to loop through the list to broadcast it out. The possible issue here is that a client could write multiple data structs before the server has looped around to reading it, and we don't have a clear way of dealing with that. (Just to confirm, can you write to a socket that hasn't been read yet?)
For now, I think we can hope that that issue won't come up. If it does, we may have to create subservers that constantly read the client sockets and queue up their requests to send to the main server.