I would like to enable tcp keepalive packets for a particular socket in a C server application hosted on HPUX 11.00.
I'm trying to use the TCP_KEEPALIVE option:
struct t_kpalive kp_opts;
len = sizeof(struct t_kpalive);
kp_opts.kp_onoff = 1;
kp_opts.kp_timeout = 300;
ret = setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &kp_opts, len);
But, when I get the new value of kp_opts, using getsockopt, this return to me "kp_opts.kp_onoff = 0". This means that I didn't change de timeout, right? Has anyone any ideas how to resolve the problem?
Thanks