Category: Linux Tips

C Sample Code for TCP Socket Server and TCP Socket Client with Explanation

In Inter-process communication. Socket is an endpoint of an interprocess communication. We can create a server socket and one client socket to create a bidirectional communication. Below I have provided one socket server and client communication. Sample Code for Socket Server: #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <error.h> #include <strings.h> #include …