2016/11/05 - SSDP

~ Don’t reinvent the wheels.

Abstract 1

The Simple Service Discovery Protocol (SSDP) is a network protocol based on the Internet Protocol Suite for advertisement and discovery of network services and presence information. It accomplishes this without assistance of server-based configuration mechanisms, such as the Dynamic Host Configuration Protocol (DHCP) or the Domain Name System (DNS), and without special static configuration of a network host.

SSDP is the basis of the discovery protocol of Universal Plug and Play (UPnP) and is intended for use in residential or small office environments. SSDP was incorporated into the UPnP protocol stack, and a description of the final implementation is included in UPnP standards documents.

Protocol transport and addressing

SSDP is a text-based protocol based on HTTPU ( HTTP with UDP, not TCP). It uses the User Datagram Protocol (UDP) as the underlying transport protocol. Services are announced by the hosting system with multicast addressing to a specifically designated IP multicast address at UDP port number 1900. In IPv4, the multicast address is 239.255.255.250 and SSDP over IPv6 uses the address set ff0X::c for all scope ranges indicated by X.

SSDP uses the HTTP method NOTIFY to announce the establishment or withdrawal of services (presence) information to the multicast group. A client that wishes to discover available services on a network, uses method M-SEARCH. Responses to such search requests are sent via unicast addressing to the originating address and port number of the multicast request.

How to broadcast your service? 2

As long as your build your service, you have to broadcast on LAN regularly. By this way, the other mechine would know whether the server is existed.

Here is the SSDP multicast NOTIFY request format:

NOTIFY *  HTTP/1.1
HOST: 239.255.255.250:1900
CACHE-CONTROL: max-age=120
NT: urn:schemas-wifialliance-org:service:WFAWLANConfig:1
USN: uuid:3b968ed4-7666-11e0-a686-002215d227b8
SERVER: UNIX/unknown UPnP/1.0 dcports/1.0
LOCATION: http://example.net/test
NTS: ssdp:alive

It is just like a HTTP request, but the command is NOTIFY, not /GET/POST….