XmlRpcSocket::nbWrite: send/write returned 207.
XmlRpcClient::writeRequest: wrote 207 of 207 bytes.
XmlRpcSocket::nbRead: read/recv returned 0.
Error in XmlRpcClient::readHeader: error while reading header (error 0) on fd 19
92.
Error calling 'AreYouAlive'
I had a similar problem in my Unix env (IRIX). While your program is running do a netstat and check the port number you are using for your server. You will probably see the list grow over time. Eventually you are unable to accept anymore connections.
What is happening is that your sockets are lingering to make sure all messages have been sent.
I added the following lines to the XmlRpcSocket::close function to force the sockets to close.
I have an application using an XmlRpcServer.
It works fine on Windows but on Linux (RedHat) this happens:
After a while (a few hours) it terminates (after it has been called succesfully a number of times), and clients trying to connect gets this respons:
XmlRpcClient::execute: method AreYouAlive (_connectionState 0).
XmlRpcClient::doConnect: fd 1992.
XmlRpcClient::generateRequest: header is 119 bytes, content-length is 88.
XmlRpcClient::writeRequest (attempt 1):
POST /RPC2 HTTP/1.1
User-Agent: XMLRPC++ 0.7
Host: 192.168.50.14:8090
Content-Type: text/xml
Content-length: 88
<?xml version="1.0"?>
<methodCall><methodName>AreYouAlive</methodName>
</methodCall>
XmlRpcSocket::nbWrite: send/write returned 207.
XmlRpcClient::writeRequest: wrote 207 of 207 bytes.
XmlRpcSocket::nbRead: read/recv returned 0.
XmlRpcClient::readHeader: re-trying connection
XmlRpcSource::close: closing socket 1992.
XmlRpcSocket::close: fd 1992.
XmlRpcSource::close: done closing socket 1992.
XmlRpcClient::doConnect: fd 1992.
XmlRpcClient::writeRequest (attempt 2):
POST /RPC2 HTTP/1.1
User-Agent: XMLRPC++ 0.7
Host: 192.168.50.14:8090
Content-Type: text/xml
Content-length: 88
<?xml version="1.0"?>
<methodCall><methodName>AreYouAlive</methodName>
</methodCall>
XmlRpcSocket::nbWrite: send/write returned 207.
XmlRpcClient::writeRequest: wrote 207 of 207 bytes.
XmlRpcSocket::nbRead: read/recv returned 0.
Error in XmlRpcClient::readHeader: error while reading header (error 0) on fd 19
92.
Error calling 'AreYouAlive'
XmlRpcClient::close: fd 1992.
XmlRpcSource::close: closing socket 1992.
XmlRpcSocket::close: fd 1992.
XmlRpcSource::close: done closing socket 1992.
Does anyone have experienced this behavior ?
I had a similar problem in my Unix env (IRIX). While your program is running do a netstat and check the port number you are using for your server. You will probably see the list grow over time. Eventually you are unable to accept anymore connections.
What is happening is that your sockets are lingering to make sure all messages have been sent.
I added the following lines to the XmlRpcSocket::close function to force the sockets to close.
void XmlRpcSocket::close(int fd)
{
#if defined(_WINDOWS)
closesocket(fd);
#else
//XXX Force socket to close
struct linger ling;
ling.l_linger=0;
setsockopt(fd,SOL_SOCKET, SO_LINGER, &ling, sizeof(ling));
::close(fd)
#endif //_WINDOWS
}
Hope this helps.
Nelson
Does anyone know how to do this for Windows? Terminate socket lingering.
Thanks