OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library http_launch_main; | 5 library http_launch_main; |
6 | 6 |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 main(List<String> arguments) { | 10 main(List<String> arguments) { |
11 int port = int.parse(arguments[0]); | 11 int port = int.parse(arguments[0]); |
12 ReceivePort receivePort = new ReceivePort(); | 12 ReceivePort receivePort = new ReceivePort(); |
13 Isolate.spawnUri(Uri.parse('http://127.0.0.1:$port/http_isolate_main.dart'), | 13 Isolate.spawnUri(Uri.parse('http://127.0.0.1:$port/http_isolate_main.dart'), |
14 ['hello'], receivePort.sendPort); | 14 ['hello'], receivePort.sendPort); |
15 receivePort.first.then((response) { | 15 receivePort.first.then((response) { |
16 print(response); | 16 print(response); |
17 }); | 17 }); |
18 } | 18 } |
OLD | NEW |