4 - More on LANs
Touching a Bit on P2
It's a chat program that will use TCP, IP (and UDP) Protocol Suite. There's provided code that will do common chat functionality (so there's no copied code). It requires you to implement the protocol though, so make sure the packet format is correct! You're going to write:
-
A client program
- Each client has a handle (a name)
- Each client will communicate to another client via their handle
-
A server program
- If there's 30 clients, how do you know which one should talk? You can't loop through them and busy-wait to check if it's active. Instead, you'll use the
poll()
call and pick the first open client that is ready to send a message.
If you wait to start this the day before, you'll fail! It's much more complex, and everything is asynchronous especially! If you screw up the syncing then the debugger may not work as intended and thus it's harder to develop this!
- If there's 30 clients, how do you know which one should talk? You can't loop through them and busy-wait to check if it's active. Instead, you'll use the