我想在ElectronJS中运行此C#代码,我如何做到这一点?
IPEndPoint serverEndPoint = new IPEndPoint(IPAddress.Parse(_ClientInfo.IpAddress), 4446);
client = new TcpClient();
client.Connect(serverEndPoint);
NetworkStream clientStream = client.GetStream();
UTF8Encoding encoder = new UTF8Encoding();
byte[] buffer = encoder.GetBytes(Command);
clientStream.Write(buffer, 0, buffer.Length);
clientStream.Flush();
client.Close();
client = null;
我尝试了这个,但是没有用。
client.connect(4446, xxx.xxx.xx.xxx, function() {
client.write(new TextEncoder().encode('blabla')); //write as Bytes
});