Python raw tcp data convert to int

Today i will talk about the python built-in function ord() .

For example, I receive raw data from serial or tcp device,the data always be the array of binary.When you print it to console,it shows like b’\x01\xe5′ and so on.

To convert this data to int like below.

raw_data = b'\x01\xe5'
print(int(ord(raw_data)),16)

Thats it! very simple!OK thanks for reading see you soon!

Enable BBR on vps

How to enable?

$ echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
$ echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# enable the config
$ sysctl -p
# run the command below , if you can see "bbr" in the output , you are success!
$ sysctl net.ipv4.tcp_available_congestion_control
$ sysctl net.ipv4.tcp_congestion_control

Why we use it?

It can lower you tcp network latency and higher you througthput

And more refer:

BBR is a google technology , you can see more in
https://github.com/google/bbr

And you can see more detail in
https://github.com/google/bbr/blob/master/Presentations/bbr-2017-02-08-google-net-research-summit.pdf