theorwa / simple-udp-server

Just a simple UDP server in C for education purposes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UDP Server in C

This repo contains a simple UDP server/client written in C. The primary purpose was for education and this should not be used in anything real. The server is well documented with comments.

Installation

If on MacOS:

$ brew install netcat

We need to use netcat instead of telnet since telnet does not support the UDP protocol.

Building the server

$ make server && ./server

Now our UDP server should be running on port 8888. We can test it out with the netcat client by opening a new terminal and running:

$ netcat -v localhost 8888 -u
  • -v will use verbose mode
  • -u will use UDP protocol

Once the client is connected you can type random words and it will get sent back to you.

$ hello
hello

Using Our Own Client

Start the server in one screen:

$ make server && ./server

Open a new tab and start the client:

$ make client && ./client

Then start typing messages.

Resources

About

Just a simple UDP server in C for education purposes


Languages

Language:C 88.1%Language:Python 10.6%Language:Makefile 1.3%