File: main.cpp

package info (click to toggle)
libqxt 0.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,000 kB
  • ctags: 6,583
  • sloc: cpp: 57,582; xml: 296; sh: 256; makefile: 60; php: 14
file content (37 lines) | stat: -rw-r--r-- 859 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <QCoreApplication>
#include <QxtWebScgiConnector>
#include <QDebug>
#include <QTimer>
#include <QTextStream>



int main (int argc,char ** argv)
{
    QCoreApplication app(argc,argv);

    QxtWebScgiConnector c;
    qDebug()<<"start:"<<c.start ( 8900, QHostAddress::LocalHost );

    forever
    {
        qDebug()<<"waitForNewConnection:"<<c.waitForNewConnection(-1);
        QxtWebStatelessConnection * st=c.nextPendingConnection();
        qDebug()<<"waitForReadyRead:"<<st->waitForReadyRead(10000);



        QTextStream stream(st);
        stream<<"<h1>HI!</h1>";

        stream<<"You requested: "<<st->request().path()<<"<br/>";
        stream<<"And sent me: "<<st->readAll()<<"<br/>";
        stream<<"<form action=\"/\" method=\"post\"><input type=\"text\" name=\"text\" /></form>";
        stream.flush();
        delete (st);
    }
}