example.js
function checkHost(host,callback) {

	if(hostCache.get(host,callback)) {
		console.log('checkHost: Resolved %s from hostCache...',host);
		return true;
	}

	console.log('checkHost: Looking up %s...',host);

	var options = {
		host: host,
		port: 80,
		path: '/',
		method: 'GET'
	};

	var req = http.request(options, function(res) {
		var data = '';
		res.setEncoding('utf8');

		res.on('data', function (chunk) {
			data += chunk;
		});
		res.on('end', function () {
			hostCache.set(host,true);
		});
		res.on('error',function() {
			hostCache.set(host,false);
		});
	});
	req.on('error',function() {
		hostCache.set(host,false);
	});
	req.end();
}
function checkHost(host,callback) {

	if(hostCache.get(host,callback)) {
		console.log('checkHost: Resolved %s from hostCache...',host);
		return true;
	}

	console.log('checkHost: Looking up %s...',host);

	var options = {
		host: host,
		port: 80,
		path: '/',
		method: 'GET'
	};

	var req = http.request(options, function(res) {
		var data = '';
		res.setEncoding('utf8');

		res.on('data', function (chunk) {
			data += chunk;
		});
		res.on('end', function () {
			hostCache.set(host,true);
		});
		res.on('error',function() {
			hostCache.set(host,false);
		});
	});
	req.on('error',function() {
		hostCache.set(host,false);
	});
	req.end();
}
function checkHost ( host , callback ) { if ( hostCache . get ( host , callback ) ) { console . log ( 'checkHost: Resolved %s from hostCache...' , host ) ; return true ; } console . log ( 'checkHost: Looking up %s...' , host ) ; var options = { host : host , port : 80 , path : '/' , method : 'GET' } ; var req = http . request ( options , function ( res ) { var data = '' ; res . setEncoding ( 'utf8' ) ; res . on ( 'data' , function ( chunk ) { data += chunk ; } ) ; res . on ( 'end' , function ( ) { hostCache . set ( host , true ) ; } ) ; res . on ( 'error' , function ( ) { hostCache . set ( host , false ) ; } ) ; } ) ; req . on ( 'error' , function ( ) { hostCache . set ( host , false ) ; } ) ; req . end ( ) ; }
Function with single argument callback
Connects to a host and returns true or false wether a connection was made

@param key Hostname
@param Function Callback
Function with single argument callback Connects to a host and returns true or false wether a connection was made