04_intro_to_sockets: update readme
This commit is contained in:
parent
0f3ad8d46d
commit
c787162c82
|
|
@ -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
|
## Description
|
||||||
a LED, a button and a temperature sensor.
|
|
||||||
|
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
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ make
|
$ 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
|
## 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
|
```bash
|
||||||
# TCP
|
# TCP
|
||||||
$ nc -l 1234
|
$ nc -l 1234
|
||||||
# UDP
|
# UDP
|
||||||
$ nc -ul 1234
|
$ 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>
|
||||||
|
```
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue