linux - TCP/IP: set socket option for keep-alive after connection has been established -


is possible set socket's so_keepalive option (tcp keep alive interval , tcp keep alive value) after hypothetical application level handshake? or have set before call accept?

i'm concerned interoperability between linux, windows , ecos lwip stack, information both platforms appreciated.

as ejp said, can set time. man page says:

setsockopt() manipulate options socket referred file descriptor sockfd.

you can set or unset so_keepalive this

int ioption = 1; // turn on keep-alive, 0 = disables, 1 = enables if (setsockopt(sockethandle, sol_socket, so_keepalive, (const char *) &ioption,  sizeof(int)) == socket_error)     {            cerr << "set keepalive: keepalive option failed" << endl;     } 

you can read tutorial more details.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

php - How do you embed a video into a custom theme on WordPress? -