A simple networking application in C that demonstrates how to create a client that connects to a server, sends and receives data over a TCP/IP connection.
Before running the application, ensure you have the following prerequisites:
- C compiler (e.g., GCC)
- A Unix-like operating system (Linux, macOS, etc.)
- Clone the repository to your local machine:
git clone https://github.com/BugReportOnWeb/socket.git
cd socket
- Compile the client and server programs:
gcc -o server server.c
gcc -o client client.c
- Start the server:
./server
The server will start listening on a specified port.
- Run the client:
./client
A connection between the client and the server will be established for the exchange of messages over TCP/IP.
server.c
: Contains the code for the server-side of the example. It listens for incoming connections and handles client requests.client.c
: Contains the code for the client-side of the example. It connects to the server and communicates by sending and receiving messages.
- You can modify the code to implement your own networking protocols or application logic.
- Adjust the port number and IP address in the code to match your network configuration.