views:

37

answers:

0

Hi all,

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:

soap_destroy( &m_soapObj );
soap_end( &m_soapObj );
soap_done(&m_soapObj);

sleep(1);

soap_init(&m_soapObj);

//m_ptrThis should be initialized already
assert( m_ptrThis != NULL );
m_soapObj.user = &m_ptrThis;

m_soapObj.accept_timeout = nAcceptTimeout;
m_ptrThreadPool->SetNumThreads( nNumThreads );  
m_nSocketListener = soap_bind(&m_soapObj, NULL, nPort, nBacklog);
if (!soap_valid_socket(m_nSocketListener))
{
    throw Exception(
    "Cannot start listening on port: %d", nPort );          
}

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 not happen every time.

It's very strange.. and urgent :/

Thanks a lot in advance

EDIT The problem is solved. Many thanks to Duck!