SSDP Library for UPnP version 2.0 on Photon OS - dcasota/photonos-scripts GitHub Wiki
Lately I came across this repo https://github.com/1iveowl/SSDP.UPnP.PCL, and tried to make it run on Photon OS.
Here's a first-try-run-recipe. The repo contains a dockerfile with dotnet 2.1 prerequisites. On Photon OS 4.0 actually with dotnet-sdk 6 it is necessary to modify the dockerfile. Here's the modified dockerfile content.
FROM mcr.microsoft.com/dotnet/sdk:6.0.100 AS build
WORKDIR /app
# copy csproj and restore as distinct layers
COPY main/*.sln ./main/
COPY test/Console.NETCore.Test/*.csproj ./test/Console.NETCore.Test/
COPY test/Console.Device.NETCore/*.csproj ./test/Console.Device.NETCore/
COPY test/Unit/SSDP.Device.xUnit/*.csproj ./test//Unit/SSDP.Device.xUnit/
COPY main/SSDP.UPnP.Netstandard/*.csproj ./main/SSDP.UPnP.Netstandard/
COPY interfaces/ISSDP.UPnP.Netstandard/*.csproj ./interfaces/ISSDP.UPnP.Netstandard/
WORKDIR /app/main
RUN dotnet restore
WORKDIR /app
# copy everything else and build app
COPY . .
WORKDIR /app/test/Console.NETCore.Test/
RUN dotnet build
FROM build AS publish
WORKDIR /app/test/Console.NETCore.Test/
RUN dotnet publish -c Release -o out --source "https://api.nuget.org/v3/index.json"
EXPOSE 1900 8321 8322
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS runtime
WORKDIR /app
COPY --from=publish /app/test/Console.NETCore.Test/out/ ./
ENTRYPOINT ["dotnet", "Console.NETCore.Test.dll"]
CMD [""]
Save the dockerfile, and proceed with the following code snippet.
tdnf install dotnet-runtime dotnet-sdk -y
iptables -A INPUT -i eth0 -p udp --dport 1900 -j ACCEPT
iptables-save >/etc/systemd/scripts/ip4save
docker login
# login with your credentials
git clone https://github.com/1iveowl/SSDP.UPnP.PCL
cd SSDP.UPnP.PCL
cd src
cp /../Dockerfile ./Dockerfile
docker run -it $(docker build -q .)
Here a sample container output on Photon OS on an encapsulated Azure vnet.
root@ph4 [ ~/SSDP.UPnP.PCL/src ]# docker run -it $(docker build -q .)
IP Address: 172.17.0.2
Press any key to end (1).
Press any key to end (2)
root@ph4 [ ~/SSDP.UPnP.PCL/src ]#
If an older .net sdk and runtime are necessary, one modification is the docker container images location, see here.
In addition, on a MS windows client with temporarily deactivated software firewall, run in a powershell window:
PS C:\Users\local> $ssdpFinder = New-Object -ComObject 'UPnP.UPnPDeviceFinder'
PS C:\Users\local> $ssdpFinder.FindByType('ssdp:all', 0)
IsRootDevice : True
RootDevice : System.__ComObject
ParentDevice :
HasChildren : True
Children : System.__ComObject
UniqueDeviceName : uuid:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
FriendlyName : Compal Broadband Networks, Inc xxxxxxxx
Type : urn:schemas-upnp-org:device:InternetGatewayDevice:1
PresentationURL : http://192.168.0.1/
ManufacturerName : Compal Broadband Networks, Inc
ManufacturerURL : http://www.icbn.com.tw/
ModelName : xxxxxxxx
ModelNumber : xxxxxxxx
Description : xxxxxxxx
ModelURL : http://www.icbn.com.tw/
UPC :
SerialNumber : xxxxxxxxxxxx
Services : System.__ComObject