mb_tcp.c
changeset 12 16ea5cbbda4e
parent 10 1aed7a582ca7
equal deleted inserted replaced
11:7c955a1d39e8 12:16ea5cbbda4e
   465 #endif
   465 #endif
   466     return -1;
   466     return -1;
   467   }
   467   }
   468 
   468 
   469   /* configure the socket */
   469   /* configure the socket */
       
   470   {
       
   471    int optval;
       
   472    socklen_t optlen = sizeof(optval);
       
   473    optval = 1;
       
   474    if(setsockopt(socket_id, SOL_SOCKET, SO_KEEPALIVE, &optval, optlen) < 0) {
       
   475 #ifdef ERRMSG
       
   476     perror("setsockopt()");
       
   477     fprintf(stderr, ERRMSG_HEAD "Error configuring socket 'KeepAlive' option.\n");
       
   478 #endif
       
   479       return -1;
       
   480    }
       
   481   }
   470     /* set the TCP no delay flag. */
   482     /* set the TCP no delay flag. */
   471   {int bool_opt = 1;
   483   {int bool_opt = 1;
   472   if (setsockopt(socket_id, SOL_TCP, TCP_NODELAY,
   484   if (setsockopt(socket_id, SOL_TCP, TCP_NODELAY,
   473                  (const void *)&bool_opt, sizeof(bool_opt))
   485                  (const void *)&bool_opt, sizeof(bool_opt))
   474       < 0) {
   486       < 0) {