Douglas C. Schmidt wrote:
> Hi Richard,
>
>
>> could somebody tell me how to set up Keepalive parameters such as
>> TCP_KEEPINTVL,TCP_KEEPCNT, TCP_KEEPIDLE in ACE programming. because
>> these parameters are set up differently in windows and linux. I am
>> not sure if ACE integrates these functions together to make the
>> software portable.
>>
>
> I don't think ACE supports this stuff yet. If you'd like to
> enhance ACE to support these keepalive parameters on Windows and Linux
> (et al) please let us know.
>
> Thanks,
>
> Doug
>
These are set via a setsockopt(2) call.
So, in ACE, something like:
// Set the The time (in seconds) the connection needs to remain idle
before
// TCP starts sending keepalive probes.
optval = 30;
this->peer ().set_option (SOL_TCP, TCP_KEEPIDLE, &optval, sizeof
(optval));
// Set the maximum number of keepalive probes TCP should send before
// dropping the connection.
optval = 3;
this->peer ().set_option (SOL_TCP, TCP_KEEPCNT, &optval, sizeof (optval));
// Set the time (in seconds) between individual keepalive probes.
optval = 5;
this->peer ().set_option (SOL_TCP, TCP_KEEPINTVL, &optval, sizeof
(optval));
// Now enable all our KeepAlive settings on the socket.
optval = 1;
this->peer ().set_option (SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof
(optval));
Good Luck!
Aaron
I think that this is for linux like OSes.
Does somebody know how to do that on solaris?
There are some socket options
TCP_KEEPALIVE_THRESHOLD and TCP_KEEPALIVE_ABORT_THRESHOLD
I am not sure is it working at all (it seems like feature since solaris 10)
Any experience ?
On Win32 is quite simple (smth like):
#include <MSTcpIP.h> //from MS Platform SDK
{
tcp_keepalive ka;
ka.onoff = 1;//enable
ka.keepalivetime = 30; // TCP_KEEPIDLE
ka.keepaliveinterval = 5;// TCP_KEEPINTVL
//no TCP_KEEPCNT per socket on win32
(http://msdn2.microsoft.com/en-us/library/ms741621.aspx)
u_long bytes_ret;
ACE_OS::ioctl (peer ().get_handle (),
SIO_KEEPALIVE_VALS,
(void*)&ka,
sizeof (ka),
0,
0,
&bytes_ret,
0,
0);
}
Yes, it would be nice to have it in ACE.
Regards
Aleksandar
> _______________________________________________
> ace-users mailing list
> ace-...@mail.cse.wustl.edu
> http://mail.cse.wustl.edu/mailman/listinfo/ace-users
>
>
I agree - if you folks can figure out how to add this support in a
portable way that would be super.
Thanks,
Doug
--
Dr. Douglas C. Schmidt Professor and Associate Chair
Electrical Engineering and Computer Science TEL: (615) 343-8197
Vanderbilt University WEB: www.dre.vanderbilt.edu/~schmidt
Nashville, TN 37203 NET: d.sc...@vanderbilt.edu