Learn how a TCP server and client establish a connection using raw sockets in C.
Study a working example of fork-per-connection concurrent server handling.
Use the code as a starting point for building a custom text-based network protocol.
| arpanet107/cnetworking | ac000/find-flv | acc4github/kdenlive-omnifade | |
|---|---|---|---|
| Stars | 0 | — | 0 |
| Language | C | C | C |
| Last pushed | — | 2013-04-05 | — |
| Maintenance | — | Dormant | — |
| Setup difficulty | easy | moderate | moderate |
| Complexity | 2/5 | 2/5 | 2/5 |
| Audience | developer | developer | general |
Figures from each repo's GitHub metadata at analysis time.
Requires only a C compiler like gcc, no external libraries needed.
CNetworking is a small educational project written in C that teaches how low level network communication works using the standard sockets API found on Linux and other Unix like systems. It contains two programs, a server and a client, that talk to each other over TCP, the reliable connection based protocol used for most internet traffic. The server listens on a fixed port, waits for a client to connect, and replies with the text Hello World before closing the connection. The client connects to the server using a hostname or IP address given on the command line, receives that message, and prints it. The README walks through every step in both programs and explains what each function call is actually doing, rather than just showing the code. On the server side, it covers resolving address information, creating and binding a socket to a port, listening for incoming connections, accepting a connection, and forking a separate process to handle each client so multiple people can connect at once without blocking each other. It also explains a signal handler that cleans up finished child processes automatically. On the client side, it covers resolving the server's address, connecting to it, receiving the reply, and closing the socket. A shared helper function is explained too, which figures out whether an address is IPv4 or IPv6 so the same code can handle both. The README ends with a table summarizing the key networking concepts demonstrated, such as address resolution, the difference between passive and active sockets, the TCP handshake, concurrent client handling, and safe address printing. Building and running requires only a C compiler like gcc, with no external dependencies: compile each file separately, run the server in one terminal, then run the client in another pointed at the server's address. The project suggests further learning steps such as adding two way communication, or replacing the fork based approach with a thread pool or an event based model like select, poll, or epoll.
CNetworking is a small educational C project with a server and client that teach how TCP sockets work step by step.
Mainly C. The stack also includes C, POSIX Sockets, TCP.
No license information is provided in the README.
Setup difficulty is rated easy, with roughly 5min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Don't trust strangers blindly. Verify against the repo.