Using TCP_KEEPALIVE


 
Thread Tools Search this Thread
Operating Systems HP-UX Using TCP_KEEPALIVE
# 1  
Old 10-15-2004
Using TCP_KEEPALIVE

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?

ThanksSmilie
Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question
tcp.h(3HEAD)							      Headers							      tcp.h(3HEAD)

NAME
tcp.h, tcp - definitions for the Internet Transmission Control Protocol (TCP) SYNOPSIS
#include <netinet/tcp.h> DESCRIPTION
The <netinet/tcp.h> header defines the following macro for use as a socket option at the IPPROTO_TCP level: TCP_NODELAY Avoid coalescing of small segments. The macro is defined in the header. The implementation need not allow the value of the option to be set with setsockopt() or retrieved with getsockopt(). ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
getsockopt(3XNET), socket.h(3HEAD), attributes(5), standards(5) SunOS 5.11 10 Sep 2004 tcp.h(3HEAD)