title: TCP Connect error 115 Operation in Progress What is the Cause?
body: <p>My application creats a TCP connection, This is working normaly.
  But in one network server has many IP  say</p>
  
  <ul>
  <li>174.X.X.X</li>
  <li>54.x.x.x
  like this </li>
  </ul>
  
  <p>When calling TCP connect (Non blocking with timeout of 60 seconds) 
  to IP <code>174.X.X.X</code>  is always success .
  But TCP connect to same server with ip <code>54.x.x.x</code>  is failing (most of the times) with errno 115 
  measn operation in progress.</p>
  
  <p>Can you please explain me what are the possible reason for errno 115</p>
  
  <p>OS : Linux</p>
  
  <p>My TCP conenct code is as below</p>
  
  <pre><code>tcp_connect(......)
  {
  
    int iValOpt = 0;  
    int iLength= 0;
  
    fcnt((int)(long)SockID,F_SETFL_O_NONBLOCK);
  
    ret = connect (sockID,(struct sockaddr*)pstSockAdr,uiSockLen);
  
    if (ret &lt; 0)
    {
  
          if (errno == EINPROGRESS)
          {
                  stTv.tv_sec = 60;
                  stTv.tv_usec = 0;
                  FD_ZERO(&amp;write_fd);
                  FD_SET(sockID,&amp;write_fd);
  
                  iLength = sizeof(int);
  
                  if (0 &lt; select (sockID+1) , NULL,&amp;write_fd,NULL,&amp;stTv);
  
                  {
                          if(0 &gt; getsockopt(sockID,SOL_SOCKET,SO_ERROR,(void*)(&amp;iValOpt),&amp;iLength))
                          {
                                  return -1
                          }
  
                          if (0 != iValOpt)
                          {
                                  return -1;
                          }
  
  
                          return success;
                  }
  
                  else
                  {
                          return -1;
                  }   
  
          }
          else
          {
                  return -1;
          }
      }
  
     return success;
  
  }
  </code></pre>