title: gSOAP does **not** close sockets?
body: <p>I've an issue with gSoap - it's not closing the socket.. Here's the situation: the application is working fine, but when I call "reload" function, it cannot reconnect.. Here's a piece of code:</p>
  
  <pre><code>soap_destroy( &amp;m_soapObj );
  soap_end( &amp;m_soapObj );
  soap_done(&amp;m_soapObj);
  
  sleep(1);
  
  soap_init(&amp;m_soapObj);
  
  //m_ptrThis should be initialized already
  assert( m_ptrThis != NULL );
  m_soapObj.user = &amp;m_ptrThis;
  
  m_soapObj.accept_timeout = nAcceptTimeout;
  m_ptrThreadPool-&gt;SetNumThreads( nNumThreads );  
  m_nSocketListener = soap_bind(&amp;m_soapObj, NULL, nPort, nBacklog);
  if (!soap_valid_socket(m_nSocketListener))
  {
      throw Exception(
      "Cannot start listening on port: %d", nPort );          
  }
  </code></pre>
  
  <p>and it throws.. When I try to use soap_free, the program crashes, as I don't create new Soap object, just initialize it again. SO, soap_done should work. And the interesting thing is, that this does <strong>not</strong> happen every time.</p>
  
  <p>It's very strange.. and urgent :/</p>
  
  <p>Thanks a lot in advance</p>
  
  <p><strong>EDIT</strong> The problem is solved. Many thanks to Duck!</p>