Home socket comunication - compare C# with Node.js
Reply: 0

socket comunication - compare C# with Node.js

user1123 Published in April 25, 2018, 10:51 am

I'm trying to send TCP message from .Net application to running Matlab script.

Working example of socket client I tested with Matlab server is in Node.js:

var net = require('net');
var client = net.connect({port: 8000},
    function() { //'connect' listener
  console.log('connected to server!');
  var data = 'Message/';

WireShark sniff for Node.js:

My C# code (rewritten for naked Socket) is:

IPAddress newIpAddress = new IPAddress(16777343);
IPEndPoint ipe = new IPEndPoint(newIpAddress, port);

Socket s =
    new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
int byteCount = Encoding.ASCII.GetByteCount(message);
byte[] sendData = new byte[byteCount];
sendData = Encoding.ASCII.GetBytes(message);

s.Send(sendData, byteCount, 0);

WireShark sniff for C# (packages from 6 - 9 are diffrent in Seq and Ack):

These two solutions tested for Hercules.exe give the same results.

Why c# solution isn't recived by Matlab server?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.310636 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO