Commit 26a7fb4a authored by Dennis Willers's avatar Dennis Willers 🏀

Socketserver with test client

parent fa9d823f
Pipeline #412 passed with stages
in 2 minutes and 46 seconds
...@@ -142,7 +142,7 @@ server.listen(3000); ...@@ -142,7 +142,7 @@ server.listen(3000);
console.log('Server is listening at port' + port); console.log('Server is listening at port' + port);
console.log('Server ip :' + ipaddr); console.log('Server ip :' + ipaddr);
console.log('Server is IP4/IP6 : ' + family); console.log('Server is IP4/IP6 : ' + family);
});*/ });
...@@ -157,12 +157,12 @@ if(islistening){ ...@@ -157,12 +157,12 @@ if(islistening){
setTimeout(function(){ setTimeout(function(){
server.close(); server.close();
},5000000); },5000000);
*/
//---------------------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 port:3000
}); });
...@@ -217,3 +217,24 @@ clients.on('end', () => { ...@@ -217,3 +217,24 @@ clients.on('end', () => {
console.log('disconnected from server'); console.log('disconnected from server');
}); });
*/ */
// ---------------------------------------------- //
/*var client = new net.Socket();
client.connect(8080, 'm.willers.digital', function() {
console.log('Connected');
client.write('Hello, server! Love, Client.');
});
client.on('data', function(data) {
console.log('Received: ' + data);
client.destroy(); // kill client after server's response
});
client.on('close', function() {
console.log('Connection closed');
});*/
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