質問

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