$ show Yortw/RSSDP
RSSDP is a .NET library implementing the Simple Service Discovery Protocol (SSDP) for UPnP device discovery and advertisement. The library enables applications to discover network services and advertise their own services on local networks using UDP multicast communication. It provides a clean separation of concerns with distinct components for device discovery (SsdpDeviceLocator), device publication (SsdpDevicePublisher), and network communication handling (SsdpCommunicationsServer). The library follows .NET best practices with interface-based dependency injection, proper IDisposable implementation, and event-driven architecture for device lifecycle events. It supports multiple .NET platforms including .NET Framework 4.8+, .NET 6/8+, .NET Standard 2.0, and Xamarin platforms via MAUI. The repository includes comprehensive unit tests, sample applications (console, MAUI, UWP), and generated documentation via DocFX.
The LLM identified 5 files worth highlighting for reuse:
Implements device discovery functionality by sending SSDP search requests and listening for responses/notifications. Demonstrates good use of dependency injection through ISsdpCommunicationsServer and ISocketFactory abstractions, making it highly testable and platform-independent. Follows event-driven pattern with DeviceAvailable/DeviceUnavailable events for real-time updates.
Handles device advertisement by sending SSDP NOTIFY messages and responding to M-SEARCH searches. Shows proper implementation of the disposable pattern through inheritance from DisposableManagedObjectBase, ensuring clean resource management. Uses observer pattern to notify subscribers of service lifecycle changes via ServiceAdded/ServiceRemoved events.
Encapsulates low-level UDP socket operations for sending/receiving SSDP messages. Implements template method pattern for message processing and provides configurable reliability through UdpSendCount/UdpSendDelay parameters. Demonstrates excellent resource management with proper socket disposal and sharing semantics via IsShared property.
Provides a robust base class for implementing IDisposable with thread-safety checks and proper disposal pattern. Includes IsDisposed property and ThrowIfDisposed method to prevent object use after disposal. This reusable component solves a common problem in .NET resource management and is widely used throughout the library.
Defines an abstraction for creating platform-specific UDP sockets, enabling the library to work across different .NET implementations. Demonstrates the factory pattern applied to network abstraction, allowing seamless switching between different socket implementations without changing core logic.