Q:

Combining Nodejs Net socket and Socket IO

I have a windows application (Built on C# as windows service) that sends data to NodeJs Net Socket, So since Socket.IO helps making a Web Application a live one , without the need of reload. How can i allow Socket.IO stream the received data from NodeJs Net Socket to the Web Application , in the exact moment the Net Socket receives data from C#?
So in the code that receives the socket data from C#:
var net = require('net');
    net.createServer(function (socket) {
        socket.on('data', function (data) {
                broadcast(socket.name + "> \n" + data + " \n", socket);
                socket.end("<EOF>");

                //send data to web interface , does it work that way?
                //SomeFooToSendDataToWebApp(Data)
        });
   });

Further more for the Socket.IO i have those lines , which i cant really figure out how to deal with them:
//Should it listen to net socket or web socket?
server.listen(8080);

// Loading socket.io
var io = require('socket.io').listen(server);

// It works but only for one request
io.sockets.on('connection', function (socket2) {
    socket2.emit('message' , 'Message Text');   
});

P.S: I am new to nodejs & socket.io , so if its possible as well to explain their behavior.
Edit 1 : My Front End Javascript to check it if it has any problems:
  //for now it listens to http port , which Socket.IO listens to
  var socket = io.connect('http://localhost:8080');
            var myElement = document.getElementById("news");
            socket.on('message', function(message) {
                document.getElementById("news").innerHTML  = message;
            })

Edit 2 : Did follow jfriend00's answer as it seems my previous code tries were trying to send messages to an unknown socket, i only added this since i needed it to be sent to all the connected clients , so only one line fixed it !
 socket.on('data', function (data) {
                broadcast(socket.name + "> \n" + data + " \n", socket);
                socket.end("<EOF>");

                //send data to web interface , does it work that way?
                //The Added code here:
                io.emit('message',data + " more string");

        });

A:

It's a bit hard to tell exactly what you're asking.
If you have some data you want to send to all connected socket.io clients (no matter where the data came from), then you can do that with:
io.emit("someMessage", dataToSend);

If you want to send to only one specific connected client, then you have to somehow get the socket object for that specific client and then do:
socket.emit("someMessage", dataToSend);

How you get the specific socket object for the desired connected client depends entirely upon how your app works and how you know which client it is.  Every socket connection on the server has a socket.id associated with it.  In some cases, server code uses that id to keep track of a given client (such as putting the id in the session or saving it in some other server-side data).  If you have the id for a socket, you can get to the socket with the .to() method such as:
io.to(someId).emit("someMessage", dataToSend);

Your question asked about how you send data received from some C# service over a normal TCP socket.  As far as sending it to a socket client, it does not matter at all where the data came from or how you received it.  Once you have the data in some Javascript variable, it's all the same from there whether it came from a file, from an http request, from an incoming TCP connection in your C# service, etc...  It's just data you want to send.

