You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
481 B

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");