title: python xmlrpc.client.ServerProxy - how to specify local port range
body: <p>Is there an easy way to specify the source port range the xml-rpc client connection should originate from? </p>
  
  <p>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). </p>
  
  <p>By default the <code>xmlrpc.client.ServerProxy</code>  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 <code>netstat -b</code> shows such connections: </p>
  
  <pre><code>C:\tmp&gt;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
  </code></pre>
  
  <p>What I would like to achieve is a configurable range for ports (15XX from the example above) the <code>xmlrpc.client.ServerProxy</code> would use when calling rpc methods on the server. </p>