Add keepalive_time option

Added `-k KEEPALIVE_TIME` option to set the period of keepalive in seconds. 
0 means infinity (keepalive as long as possible). 

I am testing this on my production environment from 3 hours ago, and it is working well.