3
我創建的Windows應用商店的客戶端套接字(TCP)(8 \地鐵\ RT)應用程序,我想使用此代碼來發送數據:DataWriter的StoreAsync如何在StreamSocket下工作?
await _socket.ConnectAsync(new HostName(ipAddress), port);
_dataWriter = new DataWriter(_socket.OutputStream);
_dataWriter.WriteBytes(bytes);
await _dataWriter.StoreAsync();
//Does execution in this line mean that bytes were sent
//and TCP packet acknowledge has been received?
因此問題中的註釋。
謝謝,我也這麼想。 – Nagg
因此,添加FlushAsync()將無法幫助解決問題嗎? –
@TimBertalot:'FlushAsync'將刷新'Stream'緩衝區,將字節發送到網絡層。它不會通過網絡發送它們,也不會等待「ACK」。 –