Вопрос

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