public class StreamServerImpl extends Object implements StreamServer<StreamServerConfigurationImpl>
This implementation DOES NOT WORK on Android. Read the Cling manual for alternatives on Android.
Modifier and Type | Class and Description |
---|---|
protected class |
StreamServerImpl.ApacheServerConnection |
Modifier and Type | Field and Description |
---|---|
protected StreamServerConfigurationImpl |
configuration |
protected org.apache.http.params.HttpParams |
globalParams |
protected Router |
router |
protected ServerSocket |
serverSocket |
Constructor and Description |
---|
StreamServerImpl(StreamServerConfigurationImpl configuration) |
Modifier and Type | Method and Description |
---|---|
StreamServerConfigurationImpl |
getConfiguration() |
int |
getPort()
This method will be called potentially right after
StreamServer.init(java.net.InetAddress, org.fourthline.cling.transport.Router) , the
actual assigned local port must be available before the server is started. |
void |
init(InetAddress bindAddress,
Router router)
Configures the service and starts any listening sockets.
|
protected boolean |
isConnectionOpen(Socket socket)
Writes a space character to the output stream of the socket.
|
protected boolean |
isConnectionOpen(Socket socket,
byte[] heartbeat) |
void |
run() |
void |
stop()
Stops the service, closes any listening sockets.
|
protected final StreamServerConfigurationImpl configuration
protected Router router
protected ServerSocket serverSocket
protected org.apache.http.params.HttpParams globalParams
public StreamServerImpl(StreamServerConfigurationImpl configuration)
public StreamServerConfigurationImpl getConfiguration()
getConfiguration
in interface StreamServer<StreamServerConfigurationImpl>
public void init(InetAddress bindAddress, Router router) throws InitializationException
StreamServer
init
in interface StreamServer<StreamServerConfigurationImpl>
bindAddress
- The address to bind any sockets on.router
- The router which handles the incoming UpnpStream
.InitializationException
- If the service could not be initialized or started.public int getPort()
StreamServer
StreamServer.init(java.net.InetAddress, org.fourthline.cling.transport.Router)
, the
actual assigned local port must be available before the server is started.getPort
in interface StreamServer<StreamServerConfigurationImpl>
public void stop()
StreamServer
stop
in interface StreamServer<StreamServerConfigurationImpl>
protected boolean isConnectionOpen(Socket socket)
This space character might confuse the HTTP client. The Cling transports for Jetty Client and Apache HttpClient have been tested to work with space characters. Unfortunately, Sun JDK's HttpURLConnection does not gracefully handle any garbage in the HTTP request!
protected boolean isConnectionOpen(Socket socket, byte[] heartbeat)
Copyright © 2014 4th Line GmbH, Switzerland. All Rights Reserved.