https://github.com/andy5995/c_networking_examples
TCP and UDP examples of networking in C
https://github.com/andy5995/c_networking_examples
c meson mit networking tcp udp
Last synced: 4 months ago
JSON representation
TCP and UDP examples of networking in C
- Host: GitHub
- URL: https://github.com/andy5995/c_networking_examples
- Owner: andy5995
- License: mit
- Created: 2022-04-19T06:22:26.000Z (about 4 years ago)
- Default Branch: trunk
- Last Pushed: 2025-08-11T20:53:44.000Z (10 months ago)
- Last Synced: 2025-10-08T15:45:26.398Z (8 months ago)
- Topics: c, meson, mit, networking, tcp, udp
- Language: C
- Homepage: https://github.com/andy5995/c_networking_examples
- Size: 72.3 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/andy5995/c_networking_examples/actions/workflows/c-cpp.yml)
# C Networking Examples
TCP and UDP examples of networking in C
Website: https://github.com/andy5995/c_networking_examples
## TCP SDL Window Updater server and client
When you connect to the server with the client, a window rendered with sdl
will be created. Clicking in the client or server window will move a geometric
shape to the coordinates where you clicked.
## Dual Stack Echo Server
The server listens for connections on both ipv4 and ipv6 addresses. To test,
run the server, and in a different window, enter in either of the following:
./dual_stack_echo_client 127.0.0.1
./dual_stack_echo client ::1
## TCP File Transfer
Transfer a plain text or binary file of any size from the client to
the server
## TCP Chat
Simple chat program
## TCP Chat server with multiple connections
Handles multiple connections. The server will tell you when clients
connect and disconnect. Every client will see the message sent by any
other single client. Use any telnet program to connect.
Adapted from [pollserver.c](https://beej.us/guide/bgnet/html/#fnref29)
## UDP echo server/client
The server echoes a message sent by the client back to the client.
client usage: ./udp_echo_client host port msg...
server usage: ./udp_echo_server port
## Additional Information
Unless otherwise specified, the clients in these examples use
"127.0.0.1" for the address and port 8080 as the defaults, but they
can be changed at runtime:
-a
-p
The servers will most likely bind to "0.0.0.0" and there's no option
to change that yet.
## Compiling
```sh
meson builddir
cd builddir
ninja
```
## See Also
* [Beej's Guide to Network Programming](https://beej.us/guide/bgnet/)