3 * Copyright (C)2007-2008 Versabanq Innovations Inc. and contributors.
4 * See the included file named LICENSE for license information.
7 using System
.Collections
;
13 static IEnumerable
contprint(WvLog log
, WvStream s
, string prefix
)
19 string str
= s
.read(128).FromUTF8();
20 log
.print("{0}#{1}: {2}\n", prefix
, i
, str
);
25 public static void Main()
28 Console
.WriteLine("stdout works.");
29 Console
.OpenStandardError().write("stderr works.\n".ToUTF8());
31 WvLog log
= new WvLog("main");
33 log
.print(" world!\n");
35 WvStream s1
= new WvTcp("localhost", 80);
36 WvStream s2
= new WvTcp("localhost", 80);
37 s1
.onreadable
+= contprint(log
, s1
, "\nA\n").ToAction();
38 s2
.onreadable
+= contprint(log
, s2
, "\nB\n").ToAction();
39 s1
.print("GET / HTTP/1.0\r\n\r\n");
40 s2
.print("FOO / HTTP/1.0\r\n\r\n");
41 while (s1
.ok
|| s2
.ok
)
44 log
.print("s1 err: {0}\n", s1
.err
.Short());
45 log
.print("s2 err: {0}\n", s2
.err
.Short());