使用阻塞的流式.NET套接字,我正在連接到服務器。每當我讀取少量數據時,一切都會順利進行,并將數據接收到我的緩沖區中:using (var socket = new Socket(SocketType.Stream, ProtocolType.IP)){ socket.Connect(IPAddress.Parse("127.0.0.1"), 5000); byte[] buffer = new byte[BufferSize]; socket.Receive(buffer); // Here buffer doesn't always contain all data the server sent me? Console.WriteLine(Encoding.Default.GetString(buffer));}但是在某些情況下,我沒有收到服務器發送給我的所有信息。數據似乎被砍掉了。這可能是什么原因?
- 1 回答
- 0 關注
- 656 瀏覽
添加回答
舉報
0/150
提交
取消