Is there an easy way to specify the source port range the xml-rpc client connection should originate from?
Let's suppose there is a firewall between the client and xml-rpc server which passes traffic to the server only from specific sockets (defined by IP and port range).
By default the xmlrpc.client.ServerProxy
lets the OS to decide which local port to use. As a result each xml-rpc call opens connection to the server originating from its own socket which stays in TIME_WAIT state until the timeout expires. On windows netstat -b
shows such connections:
C:\tmp>netstat -b | grep 51000
TCP ZIBI:51000 localhost:1552 TIME_WAIT 0
TCP ZIBI:51000 localhost:1562 TIME_WAIT 0
TCP ZIBI:51000 localhost:1561 TIME_WAIT 0
TCP ZIBI:51000 localhost:1553 TIME_WAIT 0
TCP ZIBI:51000 localhost:1559 TIME_WAIT 0
TCP ZIBI:51000 localhost:1558 TIME_WAIT 0
TCP ZIBI:51000 localhost:1557 TIME_WAIT 0
What I would like to achieve is a configurable range for ports (15XX from the example above) the xmlrpc.client.ServerProxy
would use when calling rpc methods on the server.