How to make tcp connection keep-alive

  1. My goal is: I wanna post data to server frequently using mg_connect_http(), like polling. but I found that a new tcp connection was created when post data to the same server. so I wanna make tcp keep-alive. is there any help?
  2. My actions are:
    struct mg_mgr mgr;
    mg_mgr_init(&mgr, NULL);
    for(int i=0;i<10;i++)
    {
    exit_flag = 0;
    mg_connect_http(&mgr, ev_handler, url, “Connection: keep-alive\r\n”, NULL);
    while (exit_flag == 0) {
    mg_mgr_poll(&mgr, 1000);
    }
    Sleep(100);
    }
    mg_mgr_free(&mgr);
    return 0;