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 / C++ / MFC
  4. bind() to specific network interface before connect()

bind() to specific network interface before connect()

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmintestingbeta-testinghelpquestion
5 Posts 2 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.
  • A Offline
    A Offline
    Alexander M
    wrote on last edited by
    #1

    Hi I have a machine with several network interfaces that route through different NAT VPNs. I've created a testing application that bind()s to one of these interfaces before calling connect(), which works excellent in Windows 7. When I try the same thing in Windows XP, bind() succeeds, but connect() fails with 10065 (WSAEHOSTUNREACH) after some seconds of blocking. I checked Wireshark, and there isn't even one single packet sent/received on each interface. Any ideas what may be the problem?

    Don't try it, just do it! ;-)

    S 1 Reply Last reply
    0
    • A Alexander M

      Hi I have a machine with several network interfaces that route through different NAT VPNs. I've created a testing application that bind()s to one of these interfaces before calling connect(), which works excellent in Windows 7. When I try the same thing in Windows XP, bind() succeeds, but connect() fails with 10065 (WSAEHOSTUNREACH) after some seconds of blocking. I checked Wireshark, and there isn't even one single packet sent/received on each interface. Any ideas what may be the problem?

      Don't try it, just do it! ;-)

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      OK, this is probably a stupid question (so I won't be unhappy if I get a stupid answer :-)) but are you sure the host is reachable through that interface on the XP host? Have you checked with some other network application?

      Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

      A 2 Replies Last reply
      0
      • S Stuart Dootson

        OK, this is probably a stupid question (so I won't be unhappy if I get a stupid answer :-)) but are you sure the host is reachable through that interface on the XP host? Have you checked with some other network application?

        Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

        A Offline
        A Offline
        Alexander M
        wrote on last edited by
        #3

        yea it is reachable. When i switch the default gateway to the interface i want to use i can reach the hosts. the routes should be fine.

        ===========================================================================
        Schnittstellenliste
        0x1 ........................... MS TCP Loopback interface
        0x2 ...00 0c 29 70 8c 43 ...... VMware Accelerated AMD PCNet Adapter - Paketplaner-Miniport
        0x10004 ...00 0c 29 70 8c 39 ...... VMware Accelerated AMD PCNet Adapter

        ===========================================================================
        Aktive Routen:
        Netzwerkziel Netzwerkmaske Gateway Schnittstelle Anzahl
        0.0.0.0 0.0.0.0 192.168.178.1 192.168.178.28 1
        0.0.0.0 0.0.0.0 192.168.179.1 192.168.179.130 100
        127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
        192.168.178.0 255.255.255.0 192.168.178.28 192.168.178.28 1
        192.168.178.28 255.255.255.255 127.0.0.1 127.0.0.1 1
        192.168.178.255 255.255.255.255 192.168.178.28 192.168.178.28 1
        192.168.179.0 255.255.255.0 192.168.179.130 192.168.179.130 100
        192.168.179.130 255.255.255.255 127.0.0.1 127.0.0.1 100
        192.168.179.255 255.255.255.255 192.168.179.130 192.168.179.130 100
        224.0.0.0 240.0.0.0 192.168.178.28 192.168.178.28 1
        224.0.0.0 240.0.0.0 192.168.179.130 192.168.179.130 100
        255.255.255.255 255.255.255.255 192.168.178.28 192.168.178.28 1
        255.255.255.255 255.255.255.255 192.168.179.130 192.168.179.130 1
        Standardgateway: 192.168.178.1

        Ständige Routen:
        Keine

        Don't try it, just do it! ;-)

        1 Reply Last reply
        0
        • S Stuart Dootson

          OK, this is probably a stupid question (so I won't be unhappy if I get a stupid answer :-)) but are you sure the host is reachable through that interface on the XP host? Have you checked with some other network application?

          Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

          A Offline
          A Offline
          Alexander M
          wrote on last edited by
          #4

          I think I've found the reason.. http://technet.microsoft.com/en-us/magazine/cc137807.aspx Windows XP uses weak host model, Vista and later strong host model. There doesn't seem to be a way to configure this in Windows XP which is particularly ANNOYING!!

          Don't try it, just do it! ;-)

          S 1 Reply Last reply
          0
          • A Alexander M

            I think I've found the reason.. http://technet.microsoft.com/en-us/magazine/cc137807.aspx Windows XP uses weak host model, Vista and later strong host model. There doesn't seem to be a way to configure this in Windows XP which is particularly ANNOYING!!

            Don't try it, just do it! ;-)

            S Offline
            S Offline
            Stuart Dootson
            wrote on last edited by
            #5

            Woah - your network-fu is way stronger than mine :-)

            Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

            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