Could you please look at the following patch: 
https://github.com/shripchenko/libzmq/commit/0c3d9179262ab431b8949b8646eed9a1a1e4a233

I implemented new setsockopts(): ZMQ_TCP_KEEPALIVE, ZMQ_TCP_KEEPALIVE_CNT, 
ZMQ_TCP_KEEPALIVE_IDLE, ZMQ_TCP_KEEPALIVE_INTVL
to configure TCP keep-alives on TCP sockets(keep-alives are fully transparent 
to the program and functions like select(), poll(), e.t.c.)
They all defaults to -1 which means ignore them and leave it all for OS 
defaults.
If some of them not supported by OS then 
zmq->socket()->setsockopt(ZMQ_TCP_KEEPALIVE*) call will return 0 but leave 
option = -1.

The big problem here is that although SO_KEEPALIVE is cross-platform safe(at 
least Internet said so, but still needs to be tested on all platforms),
All other options like TCP_KEEPCNT, TCP_KEEPIDLE, TCP_KEEPINTVL work on linux, 
possibly work in *bsd and will not work on windows in current implementation.



On windows it could be done with this code:



tcp_keepalive alive;

alive.onoff = TRUE;

alive.keepalivetime = 60000;

alive.keepaliveinterval = 1000;

int bytes_ret=0;

res = WSAIoctl(socket, SIO_KEEPALIVE_VALS, &alive, sizeof(alive), NULL, 0,

    &bytes_ret, NULL, NULL);





Unfortunately I have no windows knowledge, so could someone please help me to 
modify this patch to work on windows.



P.S.

And test it on other platforms.

________________________________

This message is intended only for the person(s) to which it is addressed and 
may contain Intermedia.net Inc privileged, confidential and/or proprietary 
information. If you have received this communication in error, please notify us 
immediately by replying to the message and deleting it from your computer. Any 
disclosure, copying, distribution, or the taking of any action concerning the 
contents of this message and any attachment(s) by anyone other than the named 
recipient(s) is strictly prohibited.
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to