S:\>phantomjs --version
2.1.1
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS S:\> netstat -nat | grep 1234
PS S:\> $listener = [System.Net.Sockets.TcpListener]1234
PS S:\> netstat -nat | grep 1234
PS S:\> $listener.Start();
PS S:\> netstat -nat | grep 1234
TCP 0.0.0.0:1234 0.0.0.0:0 LISTENING InHost
var page = require('webpage').create();
page.settings.resourceTimeout = 5000; // 5 seconds
page.onResourceTimeout = function(e) {
console.log(e.errorCode); // it'll probably be 408
console.log(e.errorString); // it'll probably be 'Network timeout on resource'
console.log(e.url); // the url whose request timed out
phantom.exit(1);
};
page.open('http://localhost:1234', function (status) {
console.log('open ok');
}