我看到的最简单的选择是编写处理协议特定特性的NetworkStream子类。因此,我使用示例协议创建了类:所有数据都被打包到[[和]]中。客户必须透明地接收它。Sample network stream that wraps all sent and received data into "[[" and "]]"
通过覆盖适当的重
下面的代码运行良好,但速度非常慢: Private Function ReadBytes(ByVal NetworkStream As System.Net.Sockets.NetworkStream)As Byte()Dim Index As Integer = 0
Bytes(Index) = NetworkStream</em
我的应用程序打开一个NetworkStream和一个StreamWriter,将HL7消息发送到服务。该服务接收HL7消息,并总是返回一个确认。using (TcpClient client = new TcpClient(ip, port)) using (NetworkStreamnetworkStream = client.GetStream()) using (StreamWriter client