简体   繁体   中英

Can we enable keepalive from client side socket also?

When I did netstat -anto , I got the following output

Proto Recv-Q Send-Q Local Address               Foreign Address             State       Timer

tcp        0      0 127.0.0.1:1169              127.0.0.1:40238            ESTABLISHED off (0.00/0/0)

I guess off means that the keepalive timer is off.

Can we enable keepalive from client side socket? Or it can be enabled only for server-side code? How to enable it from the client?

You can enable SO_KEEPALIVE from any side. Just remember that the default ping-time and timeout is very long, the ping time is by default usually two hours, for example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM