문제

Does the TcpClient class keep track of the number of bytes sent, received, and error counts or is there some other class that do something similar to that? I don't think the tcpclient class can do that.

도움이 되었습니까?

해결책

No TcpClient does not keep such statistics. You could look at the interface statistics for pure send/receive (though it would include traffic other than TCP): MSDN

Most of the time TcpClient is wrapped in another class (at least it is when I use it). It would be trivial to track send/receive counts with such a wrapper.

다른 팁

TcpClient does not do that. You can write yourself a small class that tracks this state. You could derive from Stream and build a reusable stream that tracks all kinds of metrics, and otherwise just relays all commands to another stream.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top