summaryrefslogtreecommitdiffstats
path: root/tests/auto/qlocalsocket/lackey/scripts/server.js
blob: 98a83bc9dd4d327a3edd851d47058ea951d52ca4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#/bin/qscript
function QVERIFY(x, server) {
    if (!(x)) {
        throw(server.errorString());
    }
}
var server = new QScriptLocalServer;
QVERIFY(server.listen("qlocalsocket_autotest"), server);
var done = args[1];
var testLine = "test";
while (done > 0) {
    QVERIFY(server.waitForNewConnection(), server);
    var serverSocket = server.nextConnection();
    serverSocket.write(testLine);
    QVERIFY(serverSocket.waitForBytesWritten(), serverSocket);
    QVERIFY(serverSocket.errorString() == ""
            ||serverSocket.errorString() == "Unknown error", serverSocket);
    --done;
}