04_intro_to_sockets: update readme

This commit is contained in:
Daniel Meiburg 2024-05-17 11:38:01 +02:00
parent 0f3ad8d46d
commit c787162c82
Signed by: dm
GPG Key ID: E5827ECFFE0AA4F2
1 changed files with 29 additions and 4 deletions

View File

@ -1,20 +1,45 @@
# IO Access
# Daytime TCP Server and Client
This program demonstrates how to access the GPIO pins on the Raspberry Pi using
a LED, a button and a temperature sensor.
## Description
This project implements a daytime TCP/UDP server and client.
The server listens for incoming connections and responds with the current date
and time. The client sends a message to the choosing the output format of the
date and time. The server responnds with
## Usage
```bash
$ make
# start tcp server
$ bin/daytimeTCPSrv <port>
# run tcp client
$ bin/daytimeTCPCli <server-ip> <server-port> <message>
# start udp server
$ bin/daytimeUDPSrv <port>
# run udp client
$ bin/daytimeUDPCli <server-ip> <server-port> <message>
```
## Testing with nc
Clients:
Start nc as a server. It will display any data it receives. The user can make
nc reply to the client by typing in the terminal.
```bash
# TCP
$ nc -l 1234
# UDP
$ nc -ul 1234
```
Start nc as a client. It will send any data it receives from the user to the
server.
```bash
# TCP
$ nc <server-ip> <server-port>
# UDP
$ nc -u <server-ip> <server-port>
```