Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

All Superinterfaces:
  Runnable

All Known Implementing Classes:
  StreamServerImpl, 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()`
`int` | `getPort()`
`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`

### getPort

    int getPort()

### stop

    void stop()

### getConfiguration

    C getConfiguration()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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