Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Selecting outgoing addredd in HttpWebRequest [SOLVED]

Selecting outgoing addredd in HttpWebRequest [SOLVED]

Scheduled Pinned Locked Moved C#
questionannouncement
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dimitri Witkowski
    wrote on last edited by
    #1

    Hello to everyone! I'm trying to implement selection of outgoing IP address in HttpWebRequest.. I've found this piece of code:

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
        request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(Bind);
    
      static IPEndPoint Bind(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) {
          IPAddress address = IPAddress.Parse("192.168.1.6");
          return new IPEndPoint(address, 8888);
      }
    

    Everything is ok but only for the first time. When I create the second HttpWebRequest to the same uri, Bind(...) is not called. Is there any workaround? Thanks in advance. == update == I have solved it. If anyone is interested, you need to add the code: request.KeepAlive = false;

    Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.

    modified on Tuesday, February 23, 2010 9:24 AM

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups