https://github.com/musooo/socket-comunication
This project demonstrates a straightforward implementation of socket-based communication between a server and a client in C.
https://github.com/musooo/socket-comunication
c client-server example socket socket-communication tcp-socket udp-socket
Last synced: 3 months ago
JSON representation
This project demonstrates a straightforward implementation of socket-based communication between a server and a client in C.
- Host: GitHub
- URL: https://github.com/musooo/socket-comunication
- Owner: Musooo
- License: mit
- Created: 2024-12-05T14:32:40.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-15T10:07:04.000Z (about 1 year ago)
- Last Synced: 2025-02-02T03:18:32.585Z (about 1 year ago)
- Topics: c, client-server, example, socket, socket-communication, tcp-socket, udp-socket
- Language: C
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# Socket Communication Program
This project demonstrates a simple client-server communication using sockets in C. The client sends a message containing a name and age to the server, and the server responds with a greeting message.
## Prerequisites
- GCC compiler
- Make
## Files
- `client.c`: The client program
- `server.c`: The server program
- `Makefile`: The makefile to build the programs
## Build the Programs
To compile the client and server programs, run the following command in the project directory:
```sh
make
```
This will generate the executables `client` and `server`.
## Running the Programs
### Start the Server
First, start the server by running:
```sh
make run_server
```
The server will start and listen for incoming connections on port `20002`.
### Run the Client
In a separate terminal, run the client with the following command:
```sh
make run_client ARGS=" "
```
Replace `` with the name you want to send and `` with the age. For example:
```sh
make run_client ARGS="Alice 30"
```
The client will send the message to the server, and the server will respond with the person identifier.
## Clean Up
To clean up the compiled files, run:
```sh
make clean
```
This will remove the generated object files and executables.
## License
This project is licensed under the MIT License.