TCP server-client implementation in c
- Socket -> setsockopt -> Bind -> Listen -> Accept -> Send/Recv <-> send/Recv[Client]
- Socket -> Connect -> Listen[Socket] && send/Recv[Client]
- using create(), Create TCP socket.
- using bind(), Bind the socket to server address.
- using listen(), put the server socket in a passive mode, where it waits for the client to approach the server to make a connection
- using accept(), At this point, connection is established between client and server, and they are ready to transfer data.
- Go back to Step 3.
- Create TCP socket.
- connect newly created client socket to server.