开发者

How can I know if the message has been sent by Tcp Socket in C# without client reply? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, 开发者_运维百科and the expected results. See also: Stack Overflow question checklist

Closed 9 years ago.

Improve this question

How can I know if the message has been sent by Tcp Socket in C# without client reply?


If you send bytes using the Send method of a TCP Socket, TCP ensures that all bytes are delivered to the recipient. If the bytes cannot be delivered, the Send method will throw an exception.

Note, however, that a Socket may buffer some bytes before sending them, so even if TCP guarantees the delivery of the bytes, they might have not been sent yet when the Send method returns.

Also note that a program cannot determine if a TCP connection is broken if it only ever calls the Receive method. You have to send some data from time to time in order to check if the TCP connection is still working.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜