Implementing a synchronous TCP client
A synchronous TCP client is a part of a distributed application that complies with the following statements:
- Acts as a client in the client-server communication model
- Communicates with the server application using a TCP protocol
- Uses I/O and control operations (at least those I/O operations that are related to communication with a server) that block the thread of execution until the corresponding operation completes, or an error occurs
A typical synchronous TCP client works according to the following algorithm:
- Obtain the IP-address and the protocol port number of the server application.
- Allocate an active socket.
- Establish a connection with the server application.
- Exchange messages with the server.
- Shut down the connection. ...