Commit 28440615 authored by Dennis Willers's avatar Dennis Willers 🏀

Test if Host listenes makes a different

parent 26a7fb4a
Pipeline #413 passed with stages
in 2 minutes and 44 seconds
...@@ -129,8 +129,10 @@ server.on('listening',function(){ ...@@ -129,8 +129,10 @@ server.on('listening',function(){
server.maxConnections = 500; server.maxConnections = 500;
var HOST = '0.0.0.0'; // bind to all interfaces, not just loopback
var PORT = 3000;
//static port allocation //static port allocation
server.listen(3000); server.listen(PORT, HOST);
// for dyanmic port allocation // for dyanmic port allocation
...@@ -162,9 +164,10 @@ setTimeout(function(){ ...@@ -162,9 +164,10 @@ setTimeout(function(){
//---------------------client---------------------- //---------------------client----------------------
// creating a custom socket client and connecting it.... // creating a custom socket client and connecting it....
var client = new net.Socket(); /*var client = new net.Socket();
client.connect({ client.connect({
port:3000 host: 'm.willers.digital',
port: 80
}); });
client.on('connect',function(){ client.on('connect',function(){
...@@ -194,7 +197,7 @@ client.on('data',function(data){ ...@@ -194,7 +197,7 @@ client.on('data',function(data){
/*setTimeout(function(){ /*setTimeout(function(){
client.end('Bye bye server'); client.end('Bye bye server');
},5000); },5000);
*/
//NOTE:--> all the events of the socket are applicable here..in client... //NOTE:--> all the events of the socket are applicable here..in client...
...@@ -204,8 +207,8 @@ client.on('data',function(data){ ...@@ -204,8 +207,8 @@ client.on('data',function(data){
// u can also => write the below code in seperate js file // u can also => write the below code in seperate js file
// open new node instance => and run it... // open new node instance => and run it...
const clients = net.connect({port: 3000}, () => { /*const clients = net.connect({port: 3000}, () => {
// 'connect' listener // 'connect' 3201
console.log('connected to server!'); console.log('connected to server!');
clients.write('world!\r\n'); clients.write('world!\r\n');
}); });
...@@ -216,7 +219,7 @@ clients.on('data', (data) => { ...@@ -216,7 +219,7 @@ clients.on('data', (data) => {
clients.on('end', () => { clients.on('end', () => {
console.log('disconnected from server'); console.log('disconnected from server');
}); });
*/ //*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment