OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import 'dart:async'; |
| 6 import 'dart:io'; |
| 7 |
| 8 void main() { |
| 9 int port = int.parse(new Options().arguments.first); |
| 10 var client = new HttpClient(); |
| 11 const MAX = 64; |
| 12 int count = 0; |
| 13 void run() { |
| 14 if (count++ == MAX) exit(0); |
| 15 Socket.connect('127.0.0.1', port).then((socket) { |
| 16 socket.write("POST / HTTP/1.1\r\n"); |
| 17 socket.write("Content-Length: 10\r\n"); |
| 18 socket.write("\r\n"); |
| 19 socket.write("LALALA"); |
| 20 socket.destroy(); |
| 21 socket.listen(null, onDone: run); |
| 22 }); |
| 23 } |
| 24 for (int i = 0; i < 4; i++) run(); |
| 25 } |
| 26 |
OLD | NEW |