All Projects → resourcepool → ssdp-client

resourcepool / ssdp-client

Licence: Apache-2.0 license
The most lightweight asynchronous Java SSDP (Simple Service Discovery Protocol) Client

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to ssdp-client

WPWatcher
Wordpress Watcher is a wrapper for WPScan that manages scans on multiple sites and reports by email and/or syslog. Schedule scans and get notified when vulnerabilities, outdated plugins and other risks are found.
Stars: ✭ 34 (-26.09%)
Mutual labels:  service, asynchronous
bigfoot
🐾 Quickly connect IoT devices with a great UX
Stars: ✭ 55 (+19.57%)
Mutual labels:  discovery, ssdp
Aiomisc
aiomisc - miscellaneous utils for asyncio
Stars: ✭ 200 (+334.78%)
Mutual labels:  service, asynchronous
microcore
.NET Core framework for inter-service communication
Stars: ✭ 24 (-47.83%)
Mutual labels:  asynchronous, discovery
TgTwitterStreamer
Continous Integration from Twitter to Telegram.
Stars: ✭ 55 (+19.57%)
Mutual labels:  service, asynchronous
prometheus-hetzner-sd
Prometheus Service Discovery for Hetzner
Stars: ✭ 15 (-67.39%)
Mutual labels:  service, discovery
redis-registry
Service registry and discovery for Node.js on top of Redis
Stars: ✭ 26 (-43.48%)
Mutual labels:  service, discovery
SandDB
A simple immutable database for the masses.
Stars: ✭ 21 (-54.35%)
Mutual labels:  asynchronous
esa-httpclient
An asynchronous event-driven HTTP client based on netty.
Stars: ✭ 82 (+78.26%)
Mutual labels:  asynchronous
promise4j
Fluent promise framework for Java
Stars: ✭ 20 (-56.52%)
Mutual labels:  asynchronous
PandaDemo
Demo project for asynchronous render and Layout framework Panda
Stars: ✭ 15 (-67.39%)
Mutual labels:  asynchronous
SyncBinder
Android Sync Binder
Stars: ✭ 30 (-34.78%)
Mutual labels:  service
cashews
Cache with async power
Stars: ✭ 204 (+343.48%)
Mutual labels:  asynchronous
watson-discovery-food-reviews
Combine Watson Knowledge Studio and Watson Discovery to discover customer sentiment from product reviews
Stars: ✭ 36 (-21.74%)
Mutual labels:  discovery
asynckivy
async library for Kivy
Stars: ✭ 56 (+21.74%)
Mutual labels:  asynchronous
Rump
REST client for Java that allows for easy configuration and default values. Allows for quick request construction and a huge range of modifications by using response/request interceptors, adjusting default values related to HTTP requests and creating custom instances for when you need multiple API connection setups.
Stars: ✭ 55 (+19.57%)
Mutual labels:  asynchronous
AsyncIterator
An asynchronous iterator library for advanced object pipelines in JavaScript
Stars: ✭ 43 (-6.52%)
Mutual labels:  asynchronous
SupportEmail
Pre-populates emails with support information in iOS/iPadOS apps
Stars: ✭ 20 (-56.52%)
Mutual labels:  service
wordlists
Aggregated wordlist pulled from commonly used tools for discovery, enumeration, fuzzing, and exploitation.
Stars: ✭ 94 (+104.35%)
Mutual labels:  discovery
AsyncSuffix
Asynchronous methods naming checker for ReSharper
Stars: ✭ 19 (-58.7%)
Mutual labels:  asynchronous

ssdp-client

A Simple Asynchronous SSDP/1.0 UPNP/1.1 Java Client using JDK APIs only.

This library works on Android as well.

Build Status

Add it to your project

Jar Download:
https://mvnrepository.com/artifact/io.resourcepool/ssdp-client

Maven:

<!-- https://mvnrepository.com/artifact/io.resourcepool/ssdp-client -->
<dependency>
    <groupId>io.resourcepool</groupId>
    <artifactId>ssdp-client</artifactId>
    <version>2.5.1</version>
</dependency>

Gradle:

compile 'io.resourcepool:ssdp-client:2.5.1'

Changelog

2.5.1

  • Fixed release issue

2.5.0

  • #32 Handle multiple responses on its own
  • #33 Response misc behaviour
  • #35 Fixed NPE

2.4.5

  • #28 Fixed Android issue with potential interfaces not supporting Multicast
  • #29 Fixed potential NPE when stopping discovery as incoming packets are still arriving
  • #30 Fixed potential NPE when closing multicast socket before initial discovery is performed
  • #31 Implemented new SsdpClientOption to disable autoLookup
  • #31 Fixed potential concurrent modifications of the request list

2.4.4

  • #27 Fixed Android emulator issue

2.4.3

  • #22 Fixed multicast addressed datagrams
  • #23 Bumb versions

2.4.2

  • #21 Fixed notify message regex

2.4.1

  • #19 Fixed non-static builder method

2.4.0

  • #17 Fixed default options and newline bug
  • #18 Allow users to send packets without user-agent header
  • Version bumps

2.3.0

  • #9 Solved race condition on null callback
  • #13 Added custom interval between requests
  • #14 Added DiscoveryOptions and custom USER-AGENT and MX headers

2.2.0

  • #5 Solved discovery request cleaned after first call
  • #7 Solved regex parsing issue on headers with multiple spaced semicolumns

2.1.0

  • #4 Solved dynamic port on client socket binding

2.0.0

  • #2 Put Client builder as static
  • Support Update announcement of SSDP
  • Refactored packages (get ready for Java 9 module one day)

1.2.0

  • #1 Fixed NPE when no Serial Number

1.1.0

  • Resolved issue when closing socket
  • Updated docs

Usage

Discover all SSDP services:

    SsdpClient client = SsdpClient.create();
    DiscoveryRequest all = SsdpRequest.discoverAll();
    client.discoverServices(all, new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Discover specific SSDP service by serviceType (simple version):

    SsdpClient client = SsdpClient.create();
    
    DiscoveryRequest networkStorageDevice = SsdpRequest.builder()
    .serviceType("urn:schemas-upnp-org:device:networkstoragedevice:1")
    .build();
    client.discoverServices(networkStorageDevice, new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Discover specific SSDP service by serviceType (with custom options):

    SsdpClient client = SsdpClient.create();
    DiscoveryOptions options = DiscoveryOptions.builder()
    .intervalBetweenRequests(10000L) // optional interval between requests, defaults to 10 000 milliseconds
    .maxWaitTimeSeconds(3) // optional max wait time between req and response, defaults to 3 seconds
    .userAgent("Resourcepool SSDP Client") // optional custom user-agent, defaults to "Resourcepool SSDP Client"
    .build();

    DiscoveryRequest networkStorageDevice = SsdpRequest.builder()
    .serviceType("urn:schemas-upnp-org:device:networkstoragedevice:1")
    .discoveryOptions(options) // optional as well. 
    .build();
    client.discoverServices(networkStorageDevice, new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Discover specific SSDP service by serviceType (with custom options):

    SsdpClient client = SsdpClient.create();
    DiscoveryOptions options = DiscoveryOptions.builder()
    .intervalBetweenRequests(10000L) // optional interval between requests, defaults to 10 000 milliseconds
    .maxWaitTimeSeconds(3) // optional max wait time between req and response, defaults to 3 seconds
    .userAgent("Resourcepool SSDP Client") // optional custom user-agent, defaults to "Resourcepool SSDP Client"
    .build();

    DiscoveryRequest networkStorageDevice = SsdpRequest.builder()
    .serviceType("urn:schemas-upnp-org:device:networkstoragedevice:1")
    .discoveryOptions(options) // optional as well. 
    .build();
    client.discoverServices(networkStorageDevice, new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Discovery is not a mandatory activity. You might just want to listen to announcements:

    SsdpClient client = SsdpClient.create();
    client.discoverServices(null, new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Disabling automatic lookup for unknown incoming announcements

    SsdpClient client = SsdpClient.create();
    DiscoveryRequest all = SsdpRequest.discoverAll();
    DiscoveryOptions options = DiscoveryOptions.builder()
     .intervalBetweenRequests(10000L) // optional interval between requests, defaults to 10 000 milliseconds
     .maxWaitTimeSeconds(3) // optional max wait time between req and response, defaults to 3 seconds
     .userAgent("Resourcepool SSDP Client") // optional custom user-agent, defaults to "Resourcepool SSDP Client"
     .overrideBindingPort(1901)
     .build();
    client.discoverServices(all, options, new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Ignoring unavailable Multicast Interface errors

    SsdpClient client = SsdpClient.create();
    DiscoveryRequest all = SsdpRequest.discoverAll();
    client.discoverServices(all, SsdpClientOptions.builder().ignoreInterfaceDiscoveryErrors().build(), new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

Overriding default binding port (defaults to 1900)

    SsdpClient client = SsdpClient.create();
    DiscoveryRequest all = SsdpRequest.discoverAll();
    client.discoverServices(all, SsdpClientOptions.builder().ignoreInterfaceDiscoveryErrors().build(), new DiscoveryListener() {
      @Override
      public void onServiceDiscovered(SsdpService service) {
        System.out.println("Found service: " + service);
      }

      @Override
      public void onServiceAnnouncement(SsdpServiceAnnouncement announcement) {
        System.out.println("Service announced something: " + announcement);
      }
    });

When you're done, don't forget to stop the discovery:

ssdpClient.stopDiscovery();

License

Copyright 2016-2022 Resourcepool

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].