https://github.com/araobp/service-discovery
Very simple service discovery protocol
https://github.com/araobp/service-discovery
service-discovery-protocol
Last synced: about 2 months ago
JSON representation
Very simple service discovery protocol
- Host: GitHub
- URL: https://github.com/araobp/service-discovery
- Owner: araobp
- License: apache-2.0
- Created: 2020-09-05T14:38:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-06T00:14:53.000Z (over 4 years ago)
- Last Synced: 2025-01-17T18:30:07.145Z (4 months ago)
- Topics: service-discovery-protocol
- Language: C++
- Homepage:
- Size: 171 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Very simple service discovery protocol
## Motivation
My RaspberryPi 3 obtains an IP address from DHCP server on my WiFi router. The IP address changes everytime I boot the Raspberry PI.
I just want a very simple service discovery protocol to find an IP address of my RaspberryPi 3 on the LAN.
## Why not use a standard procotol?
I used to be a SIP (Session Initiation Protocol) expert. The protocol basically provides a mean to find serivces on the network, such as a VoIP service or a video broadcasting service. The protocol originated from MBONE project, very dependent on IP multicast and IP broadcast, but the protocol has become very complicated to support plane old telephony services...
If the scope is limited to my LAN at home, such a very complicated protocol is not necessary.
## Message sequence diagram
An UDP packet with a service ID in its payload is broadcast to the LAN's broadcast IP address at a certain interval:
```
Server Client
| |
|----- UDP 18084 ----->|
| |
|----- UDP 18084 ----->|
| |
|----- UDP 18084 ----->|
| |
```## Source code
### Server (C++)
C++ server code implementation that runs as a Linux daemon on Raspberry Pi:
=> [Code](./server)
And a sample systemd service file is here:
=> [Service file](./systemd)
### Client (Kotlin)
Kotlin client code for Android smartphones:
=> [Code](./client)
The GUI also shows its own IP address on its WLAN interface.