mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
28 lines
481 B
JavaScript
28 lines
481 B
JavaScript
client = new TCPClient("google.com", 80);
|
|
|
|
log("readyState: " + client.readyState);
|
|
//assertEqual(client.readystate, TCP.CONNECTING);
|
|
|
|
client.onopen = function () {
|
|
log("connected to google");
|
|
log("readyState: " + client.readyState);
|
|
client.write("GET / HTTP/1.1\r\n\r\n");
|
|
};
|
|
|
|
client.onread = function (chunk) {
|
|
log(chunk);
|
|
};
|
|
|
|
client.onclose = function () {
|
|
log("connection closed");
|
|
};
|
|
|
|
|
|
|
|
setTimeout(function () {
|
|
client.disconnect();
|
|
}, 10 * 1000);
|
|
|
|
|
|
log("hello");
|