Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/00nx/tcp-connection
an example for a simple tcp connection written purely in C
https://github.com/00nx/tcp-connection
Last synced: about 2 months ago
JSON representation
an example for a simple tcp connection written purely in C
- Host: GitHub
- URL: https://github.com/00nx/tcp-connection
- Owner: 00nx
- License: apache-2.0
- Created: 2024-10-12T07:29:55.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-10-12T07:33:15.000Z (3 months ago)
- Last Synced: 2024-10-29T05:31:38.230Z (2 months ago)
- Language: C
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TCP Server in C
This project is a simple implementation of a TCP server in C using the `sockets`
## How It Works
- The server creates a socket using the `socket()` function
- Sets socket options like `SO_REUSEADDR` and `SO_REUSEPORT` using `setsockopt()` to allow reuse of the address
- Binds the socket to an IP address (`INADDR_ANY` for any available interface) and a specified port (8080 in this case)
- Listens for incoming client connections using `listen()`
- Accepts incoming connections using `accept()` and prints any data sent by the client