简体   繁体   English

DataWriter的StoreAsync如何在StreamSocket下工作?

[英]How does DataWriter's StoreAsync work under StreamSocket?

I am creating socket client (TCP) in Windows Store (8\\Metro\\RT) app and I am trying to send data using this code: 我在Windows Store(8 \\ Metro \\ RT)应用程序中创建套接字客户端(TCP),我正在尝试使用以下代码发送数据:

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?

so the question is in the comments. 所以问题出在评论中。

No. The completion of a write operation only means that the data has been copied to an OS buffer. 否。写入操作的完成仅表示数据已复制到OS缓冲区。

There is no way to be notified when you get a TCP ACK for the data; 当您获得数据的TCP ACK时,无法通知您; however, if you do not get one (after the built-in TCP retries), then the next operation you do on the socket will result in an error. 但是,如果您没有得到一个(在内置TCP重试之后),那么您在套接字上执行的下一个操作将导致错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM