title: Is it possible to reset the ServicePointManager?
body: <p>I am attempting to following the code similar to the one given at <a href="https://stackoverflow.com/a/3428052">How does System.Net.Mail.SMTPClient do its local IP binding</a> I am using Windows 7 and .Net 4.0 on a machine with multiple IP Addresses. I have the <a href="http://msdn.microsoft.com/en-us/library/system.net.servicepoint.bindipendpointdelegate.aspx" rel="nofollow noreferrer">BindIPEndPointDelegate</a> defined </p>
  
  <pre><code>private static IPEndPoint BindIPEndPointCallback(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount)
  {
      string IPAddr = //some logic to return a different IP each time
      return new IPEndPoint(IPAddr, 0);
  }
  </code></pre>
  
  <p>I then send my email using </p>
  
  <pre><code>SmtpClient client = new SmtpClient();
  client.Host = SMTP_SERVER; //IP Address as string
  client.Port = 25;
  client.EnableSsl = false;
  client.ServicePoint.BindIPEndPointDelegate 
     = new System.Net.BindIPEndPoint(BindIPEndPointCallback);
  client.ServicePoint.ConnectionLeaseTimeout = 0;
  client.Send(msg);  //msg is of type MailMessage properly initialized/set
  client = null;
  </code></pre>
  
  <p>The first time this code gets called, the delegate gets called and whatever IP address gets set, it gets used. The subsequent times this code gets called, the delegate never gets called <strong><em>i.e. the first IP Address is used subsequently.</em></strong> Is it possible to change this situation where each time the code gets called, the delegate callback is called?</p>
  
  <p>I am thinking the <a href="http://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.aspx" rel="nofollow noreferrer">ServicePointManager</a> (which is a <strong>static class</strong>) caches the result of the first call to the delegate. Is it possible to reset this class? I don’t care about performance.</p>
  
  <p>Thank you,
  O. O.</p>