-
- netBuffer buffer ;
- trJpgFactory *JpgFactory;
-
-public:
-
- HttpdImageChannel() : buffer(512) {
- setTerminator("\r\n");
- JpgFactory = new trJpgFactory();
-
- // This is a terrible hack but it can't be initialized until
- // after OpenGL is up an running
- JpgFactory->init(400,300);
- }
-
- ~HttpdImageChannel() {
- JpgFactory->destroy();
- delete JpgFactory;
- }
-
- virtual void collectIncomingData (const char* s, int n) {
- buffer.append(s,n);
- }
-
- // Handle the actual http request
- virtual void foundTerminator (void);
-};
-
-
-class HttpdImageServer : private netChannel
-{
- virtual bool writable (void) { return false ; }
-
- virtual void handleAccept (void) {
- netAddress addr ;
- int handle = accept ( &addr ) ;
- printf("Client %s:%d connected\n", addr.getHost(), addr.getPort());
-
- HttpdImageChannel *hc = new HttpdImageChannel;
- hc->setHandle ( handle ) ;
- }
-
-public:
-
- HttpdImageServer ( int port ) {
- open ();
- bind( "", port );
- listen( 5 );
-
- printf( "HttpdImage server started on port %d\n", port ) ;
- }
-
-};
-
-
-class FGJpegHttpd : public FGProtocol {
-