nodejs 中的 C# TcpClient GetStream 相当于什么?



我正在尝试将C#套接字连接器转换为nodejs,但我不知道如何从插座读取流。基本上,我正在尝试将此代码从C#转换为nodejs:

private TcpClient client = new TcpClient();    
client.Connect(host, port);
client.NoDelay = true;
this.NetworkStream = client.GetStream();

感谢您的帮助!

net.connect()函数返回一个net.Socket实例,即流,即它实现了双工流接口。

请参阅:

  • https://nodejs.org/api/net.html#net_net_net_connect_options_connectlistener
  • https://nodejs.org/api/net.html#net_class_net_socket
  • https://nodejs.org/api/stream.html#stream_class_stream_stream_redable
  • https://nodejs.org/api/stream.html#stream_class_class_stream_wratize

最新更新