Synchronous I/O in client applications
A synchronous client will usually fall into one of the two cases:
- It requests something from the server, reads answer, and processes it. Then, ask something else, and so on. This is, in fact, what the synchronous client in the previous chapter is like.
- Read incoming message from the server, process it, then write answer. Then, read next incoming message, and so on.
Both scenarios use a make-request-read-answer strategy. In other words, one party makes a request to which the other party will answer back. This is an easy way to implement a client/server application, and that's what I highly recommend you do.