An open API service indexing awesome lists of open source software.

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

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.