Home:ALL Converter>Is socket option SO_KEEPALIVE supported for unix domain sockets (socket family AF_UNIX)?

Is socket option SO_KEEPALIVE supported for unix domain sockets (socket family AF_UNIX)?

Ask Time:2020-01-15T19:18:44         Author:alekh chaudhary

Json Formatter

In our program, communication is happening over unix domain socket. When socket is created we are enabling socket option SO_KEEPALIVE on the socket. Call to setsockopt() is successful but netstats output doesn't so it. Output is as follows.

tcp 0 0 nemo:diamServ nemo:15388 ESTABLISHED 19997/process_name keepalive (7221.16/0/0)

unix 3 [ ] STREAM CONNECTED 228473 19997/process_name /tmp/uds1.socket

In above output we can see that "keepalive" keyword for tcp socket but for unix socket this keyword is not there. We are not sure whether keepalive is enabled for unix socket or not?

Note that diamServ is the service name corresponding to the port used for tcp socket. and /tmp/uds1.socket is unix socket file generated.

Author:alekh chaudhary,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59750328/is-socket-option-so-keepalive-supported-for-unix-domain-sockets-socket-family-a
yy