Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

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.

like image 562
Nagg Avatar asked Nov 24 '25 12:11

Nagg


1 Answers

No. The completion of a write operation only means that the data has been copied to an OS buffer.

There is no way to be notified when you get a TCP ACK for the data; 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.

like image 197
Stephen Cleary Avatar answered Nov 27 '25 02:11

Stephen Cleary



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!