2009-03-13 12:22:35 +01:00
|
|
|
client = new TCPClient("google.com", 80);
|
2009-03-05 13:41:10 +01:00
|
|
|
|
|
|
|
log("readyState: " + client.readyState);
|
|
|
|
//assertEqual(client.readystate, TCP.CONNECTING);
|
|
|
|
|
|
|
|
client.onopen = function () {
|
2009-03-13 12:22:35 +01:00
|
|
|
log("connected to google");
|
2009-03-05 13:41:10 +01:00
|
|
|
log("readyState: " + client.readyState);
|
2009-03-13 12:22:35 +01:00
|
|
|
client.write("GET / HTTP/1.1\r\n\r\n");
|
2009-03-05 13:41:10 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
client.onread = function (chunk) {
|
|
|
|
log(chunk);
|
|
|
|
};
|
|
|
|
|
|
|
|
client.onclose = function () {
|
|
|
|
log("connection closed");
|
|
|
|
};
|
|
|
|
|
2009-03-13 12:22:35 +01:00
|
|
|
|
|
|
|
|
2009-03-05 13:41:10 +01:00
|
|
|
setTimeout(function () {
|
|
|
|
client.disconnect();
|
2009-03-13 12:22:35 +01:00
|
|
|
}, 10 * 1000);
|
2009-03-02 15:49:24 +01:00
|
|
|
|
|
|
|
|
2009-03-13 12:22:35 +01:00
|
|
|
log("hello");
|