diff --git a/examples/tcpserver.lyng b/examples/tcpserver.lyng index 2e14213..c4d14c9 100644 --- a/examples/tcpserver.lyng +++ b/examples/tcpserver.lyng @@ -5,28 +5,22 @@ val clientCount = 1000 val server = Net.tcpListen(0, host, clientCount, true) as TcpServer val port = server.localAddress().port -fun payloadFor(index: Int): String { - "$index:${Random.nextInt()}:${Random.nextInt()}" -} - -fun handleClient(client: TcpSocket) { - try { - val source = client.readLine() - if( source != null ) { - client.writeUtf8("pong: $source\n") - client.flush() - } - } finally { - client.close() - } -} +fun payloadFor(index: Int) = "$index:${Random.nextInt()}:${Random.nextInt()}" launch { try { - for( i in 0.. }.joinAll() assertEquals(clientCount, replies.size) - -val summary = "OK: $clientCount concurrent tcp clients" -println(summary) -summary +println("OK: $clientCount concurrent tcp clients")