Reputation: 17072
In node.js I'd like to create a client that:
Can I only use a socket that is created when my client startup and then wait for data from server1 or do I need to implement a server instead ?
Upvotes: 1
Views: 2097
Reputation: 169373
var net = require("net");
var client = net.createConnection(port, host);
client.on("connect", sendInfo);
client.on("data", readData);
client.on("end", cleanUp);
Just create a TCP connection to your server. Then just do stuff with it.
Upvotes: 2