ohmm
Class CvBase.ImageServer

java.lang.Object
  extended by ohmm.CvBase.ImageServer
Enclosing class:
CvBase

protected class CvBase.ImageServer
extends java.lang.Object

HTTP multipart/x-mixed-replace image server.

The image encoding is controlled by CvBase.serverFormat and CvBase.serverMimeType, reasonable options include jpeg and gif. The former constitutes MJPEG encoding, and gives good quality with low bandwidth, but may not be compatible with all browsers. In particular, current versions of Firefox show severe flickering with MJPEG encoding (Mozilla bug 625012). Chrome seems to work pretty well, though there are issues with non-alphanumeric keycodes. gif encoding doesn't look great due to color quantizing.

Images are served to at most one client at a time at maximum framerate CvBase.maxServerFPS.

Normally these variables are configured prior to starting the server, but it should be possible to change them online, protected by CvBase.serverLock.

The server starts automatically and listens on CvBase.serverPort iff CvBase.useServer is true.

The server knows about the following request paths:

Thus, once the server is running, you can connect to it from a remote host by bringing up e.g. Google Chrome and browsing to the url


 http://ADDR:PORT/server.html

 
where ADDR is the IP address and PORT the listening port of the server.


Field Summary
protected  java.util.concurrent.ExecutorService executor
          The transaction executor.
protected  com.sun.net.httpserver.HttpServer server
          The internal server object.
 
Constructor Summary
protected CvBase.ImageServer(int port)
          Binds server to indicated port.
 
Method Summary
protected  void stop(int delay)
          Stops server and executor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected com.sun.net.httpserver.HttpServer server
The internal server object.


executor

protected java.util.concurrent.ExecutorService executor
The transaction executor.

Constructor Detail

CvBase.ImageServer

protected CvBase.ImageServer(int port)
Binds server to indicated port.

Method Detail

stop

protected void stop(int delay)
Stops server and executor.