java.lang.Object
org.cybergarage.upnp.ssdp.HTTPUSocket
org.cybergarage.upnp.ssdp.SSDPSearchResponseSocket
All Implemented Interfaces:
Runnable

public class SSDPSearchResponseSocketextends HTTPUSocket implements Runnable
Socket for receiving SSDP search responses from UPnP devices.

This class extends HTTPUSocket and implements Runnable to provide asynchronous handling of SSDP search responses. It listens for responses to M-SEARCH messages sent during device discovery operations.

Key features:

  • Asynchronous response reception
  • SSDP search response parsing
  • Multi-threaded operation
  • Network interface binding
  • Control point notification

This class is used by UPnP control points to receive responses from devices when performing device discovery searches. It runs in a separate thread to continuously listen for incoming search responses without blocking the main application.

  • Constructor Details

    • SSDPSearchResponseSocket

      public SSDPSearchResponseSocket()
      Bind a search response socket to the default address and port.
    • SSDPSearchResponseSocket

      public SSDPSearchResponseSocket(String bindAddr, int port)
      Bind a search response socket to the given address and port.
      Parameters:
      bindAddr - the address to bind to
      port - the port to bind to
  • Method Details

    • setControlPoint

      public void setControlPoint(ControlPoint ctrlp)
      Attach the control point this socket reports search results to.
      Parameters:
      ctrlp - the control point, may be null
    • getControlPoint

      public ControlPoint getControlPoint()
      The control point this socket reports search results to.
      Returns:
      the control point, null when none is attached
    • run

      public void run()
      Watch for inbound search requests and answer them.
      Specified by:
      run in interface Runnable
    • start

      public void start()
      Start the response thread.
    • stop

      public void stop()
      Stop the response thread.
    • post

      public boolean post(String addr, int port, SSDPSearchResponse res)
      Send a search response back to the requester.
      Parameters:
      addr - the address to send to
      port - the port to send to
      res - the response to send
      Returns:
      true if the datagram was sent
    • post

      public boolean post(String addr, int port, SSDPSearchRequest req)
      Send a search request to the given address.
      Parameters:
      addr - the address to send to
      port - the port to send to
      req - the request to send
      Returns:
      true if the datagram was sent