TCP and UDP examples of networking in C
Website: https://github.com/andy5995/c_networking_examples
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.
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
Transfer a plain text or binary file of any size from the client to the server
Simple chat program
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
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
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 <address>
-p <port>
The servers will most likely bind to "0.0.0.0" and there's no option to change that yet.
meson builddir
cd builddir
ninja