Friday, 12 May 2017

NetworkStream write() with event name

I have a simple TCP server written in C#, pinging out data at a specified interval and receiving the data I have a NodeJS app.

I'm current sending the data from a NetworkStream like so:

private NetworkStream nwStream;
nwStream = clientMachine.GetStream();

nwStream.Write(buffer, 0, buffer.Length); // Inside a loop

And receiving it in NodeJS like:

client.on('data', (data) => {

Is there any way to emit a different event, other than data from my C# TCP server? Using Socket.io I can socket.emit('customEvent', someData) and receive it like socket.on('customEvent', receivedData) but I'm unsure if I can achieve this in C#.



via Jay Gould

No comments:

Post a Comment