Loading socket.js +10 −7 Changes for socket.js: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -129,8 +129,10 @@ server.on('listening',function(){ server.maxConnections = 500; var HOST = '0.0.0.0'; // bind to all interfaces, not just loopback var PORT = 3000; //static port allocation server.listen(3000); server.listen(PORT, HOST); // for dyanmic port allocation Loading Loading @@ -162,9 +164,10 @@ setTimeout(function(){ //---------------------client---------------------- // creating a custom socket client and connecting it.... var client = new net.Socket(); /*var client = new net.Socket(); client.connect({ port:3000 host: 'm.willers.digital', port: 80 }); client.on('connect',function(){ Loading Loading @@ -194,7 +197,7 @@ client.on('data',function(data){ /*setTimeout(function(){ client.end('Bye bye server'); },5000); */ //NOTE:--> all the events of the socket are applicable here..in client... Loading @@ -204,8 +207,8 @@ client.on('data',function(data){ // u can also => write the below code in seperate js file // open new node instance => and run it... const clients = net.connect({port: 3000}, () => { // 'connect' listener /*const clients = net.connect({port: 3000}, () => { // 'connect' 3201 console.log('connected to server!'); clients.write('world!\r\n'); }); Loading @@ -216,7 +219,7 @@ clients.on('data', (data) => { clients.on('end', () => { console.log('disconnected from server'); }); */ //*/ Loading Loading
socket.js +10 −7 Changes for socket.js: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -129,8 +129,10 @@ server.on('listening',function(){ server.maxConnections = 500; var HOST = '0.0.0.0'; // bind to all interfaces, not just loopback var PORT = 3000; //static port allocation server.listen(3000); server.listen(PORT, HOST); // for dyanmic port allocation Loading Loading @@ -162,9 +164,10 @@ setTimeout(function(){ //---------------------client---------------------- // creating a custom socket client and connecting it.... var client = new net.Socket(); /*var client = new net.Socket(); client.connect({ port:3000 host: 'm.willers.digital', port: 80 }); client.on('connect',function(){ Loading Loading @@ -194,7 +197,7 @@ client.on('data',function(data){ /*setTimeout(function(){ client.end('Bye bye server'); },5000); */ //NOTE:--> all the events of the socket are applicable here..in client... Loading @@ -204,8 +207,8 @@ client.on('data',function(data){ // u can also => write the below code in seperate js file // open new node instance => and run it... const clients = net.connect({port: 3000}, () => { // 'connect' listener /*const clients = net.connect({port: 3000}, () => { // 'connect' 3201 console.log('connected to server!'); clients.write('world!\r\n'); }); Loading @@ -216,7 +219,7 @@ clients.on('data', (data) => { clients.on('end', () => { console.log('disconnected from server'); }); */ //*/ Loading