Commit 28440615 authored by Dennis Willers's avatar Dennis Willers
Browse files

Test if Host listenes makes a different

parent 26a7fb4a
Loading
Loading
Loading
Loading
+10 −7
Changes for socket.js: 10 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -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
@@ -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(){
@@ -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...


@@ -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');
});
@@ -216,7 +219,7 @@ clients.on('data', (data) => {
clients.on('end', () => {
    console.log('disconnected from server');
});
*/
//*/