org.teleal.cling.transport.spi
Interface StreamServer<C extends StreamServerConfiguration>

All Superinterfaces:
Runnable
All Known Implementing Classes:
StreamServerImpl

public interface StreamServer<C extends StreamServerConfiguration>
extends Runnable

Listens to TCP connections and handles synchronous HTTP requests with UPnP message payloads.

Implementations are supposed to call Router#received(UpnpStream) with a custom UpnpStream. This will start processing of the request and run() the UpnpStream.

The custom UpnpStream implementation then passes a UpnpMessage to its process(requestMsg) method and then sends the returned response back to the client.

In pseudo-code:


 MyStreamServer implements StreamServer {
      run() {
          while (not stopped) {
              Connection con = listenToSocketAndBlock();
              router.received( new MyUpnpStream(con) );

          }
      }
 }

 MyUpnpStream(con) extends UpnpStream {
      run() {
          UpnpMessage request = readRequest(con);
          UpnpMessage response = process(request);
          sendResponse(response);
      }
 }

 


Method Summary
 C getConfiguration()
           
 void init(InetAddress bindAddress, Router router)
           
 void stop()
           
 
Methods inherited from interface java.lang.Runnable
run
 

Method Detail

init

void init(InetAddress bindAddress,
          Router router)
          throws InitializationException
Throws:
InitializationException

stop

void stop()

getConfiguration

C getConfiguration()


Copyright © 2010 Teleal GmbH, Switzerland. All Rights Reserved.