BedrockFramework
BedrockFramework copied to clipboard
Question: custom protocol: is there a way to show bytes recv/sent
Hi!
Is this a good place to ask questions?
I'm looking into the custom protocol example. MyCustomProtocol.
Is there a way to obtain the number of bytes being sent/written?
The goal would be to print typical progress showing data transfer and so on.
Thanks!
There isnt' a way to do this currently but it could be implemented as connection middleware that wraps the IDuplexPipe and stores that data in a feature. That might be something useful. What are you trying to show? Do you want all bytes ever transferred?
Hi @davidfowl ,
There are 2 things I'd like to achieve:
-
Client-side: good progress. If you implement some method-oriented thing on top of the protocol, you don't have fine-grained byte-per-byte progress unless you get it from the network. This could be done from the protocol, I think, I could have a workaround there.
-
Server-side: it is super-handy to be able to print a log of every request, saying things like bytes recv/sent, time in recv/send, total request time, etc. In my current implementation (Stream based) I place a TrafficControlStream wrapping the NetworkStream and everything is tracked there. Old-fashioned.
pablo
There isnt' a way to do this currently but it could be implemented as connection middleware that wraps the IDuplexPipe and stores that data in a feature. That might be something useful. What are you trying to show? Do you want all bytes ever transferred?
I was looking for something like this, but don't know the best way to implement it...I would like to know all the bytes ever transferred