Fw: TCP_KEEPIDLE socket option is not working

From: Radha Mohan
Date: Mon Jan 28 2008 - 00:23:45 EST


Hi,

I have a server program running under linux-2.6.15 on ARM9. I have two sockets 4096 and 4097 which accept connections from other PCs and do
send/receive data. I have set the following setsockopt for the two sockets

setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &on,sizeof(on));
setsockopt(sockfd,IPPROTO_TCP,TCP_NODELAY,&on,sizeof(int));

setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &keep_alive_time, sizeof(keep_alive_time));

alive_time = 4;

setsockopt(sockfd,IPPROTO_TCP,TCP_KEEPIDLE,&alive_time,sizeof(int));


I have no other sockets so I have set the sysctl entries
/proc/sys/net/ipv4/tcp_keepalive_probes ---> 3
/proc/sys/net/ipv4/tcp_keepalive_intvl ---> 60

So that the connections get closed if they are idle for 7 minutes.
The "alive_time" can be programmed so that different sockets can have different TCP keepidle times.

If I connect to 4096 from a Windows PC and send data then everything works fine.

But when I connect to 4097 also and transfer, both my connections at server side are getting closed in between data transfer.
>From the ethereal capture I came to know that TCP keep alive probes were sent on both sockets after 4 minutes of starting data transfer,
and after that two times with a gap of 60secs.

How can TCP keepalive kickoff when there is data transfer going on
socket. And also I am not getting TCP_keepalive_ack for the keepalive
probes sent.

One more observation is that when I do data transfer from 4096 socket
to PC socket, keepalive timer is not triggering.
Why TCP_KEEPIDLE is not working on both directions??
And also, the PC is not replying to the Keep Alive probes.

Regards,
Mohan


____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html