I am using code from :
https://stackoverflow.com/a/34605407/4758816
Works On (Ubuntu)
$ uname -a
Linux my_machine1-15-3567 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
$ netstat -nlp | grep 9091
tcp 0 0 0.0.0.0:9091 0.0.0.0:* LISTEN 5781/a.out
tcp 0 0 0.0.0.0:9091 0.0.0.0:* LISTEN 5736/a.out
But if I follow same steps on (Centos 7.5)
$uname -a
Linux my_machine2 **3.10.0**-1160.11.1.el7.x86_64 #1 SMP Fri Dec 18 16:34:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
netstat on my_machine2 shows only process which started 2nd, looks like port in being handed over to process started 2nd.
SO_REUSEPORT is added in kernel 3.9.0, not sure if centos needs any extra steps to enable same.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…