Results 1 to 16 of 16

Thread: Using two ethernet adapters

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Using two ethernet adapters

    Hello,

    I have a computer with two ethernet adapters. What I need to know, is how to specify in winsock, which adapter sends my data (They are on two seperate networks). When I try this with two adapters, Im not sure how to use the secondary card also. Any suggestions?

    EDIT: I am using VB6, and I put something similar in the older VB forum, with out many views and no responces yet. Please delete/move if necesary.

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Re: Using two ethernet adapters

    So am I asking the dumbest question in the world? Or isnt anyone sure how to send and receive from a certain ethernet card?

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Re: Using two ethernet adapters

    115 views, and still no ideas?

    Its easy in serial communications, you select which com port you use. What is the equivilent for selecting which ethernet card you use?

  4. #4
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    229

    Re: Using two ethernet adapters

    As far as I am concerned, there is no practical need to specify which network adapter to use. The OS does this for you, depending on the packet's destination.

    I'm not aware of any method of specifying the packet's "route". It's the system's job.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Re: Using two ethernet adapters

    Quote Originally Posted by Cube8 View Post
    As far as I am concerned, there is no practical need to specify which network adapter to use. The OS does this for you, depending on the packet's destination.

    I'm not aware of any method of specifying the packet's "route". It's the system's job.
    Thank you, I actually ended up finding that out from someone who was more familiar with windows networking. I guess Im just surprised more people did not know this. It is too bad that you cant infact select which card you use, like you select which port you use, in serial communication. You have to leave it up to windows.

  6. #6
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    229

    Re: Using two ethernet adapters

    What's the point in selecting a specific NIC, anyway?

  7. #7
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Using two ethernet adapters

    I agree with Cube8 - there should be no need to do this and there is a good reason the operating system does it for you. The two different NICs could be assigned different default gateways on different subnets, if you told your program to use the wrong one then nothing would get to its destination, where is with Windows managing this you just specify the destination and the OS route's it accordingly so it will get there. I dont see why you would ever want to specify which one is used..
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  8. #8
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    229

    Re: Using two ethernet adapters

    Additionally, "serial communication" and "networking" are totally different. The only thing in common is "communication" (data transfer). You do different things with each one.
    So don't confuse them.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Re: Using two ethernet adapters

    My reasoning is that they will be connected to two completely seperate networks. That should also never see each other. On one network it is assigned an ip address of 10.0.0.1xx and the other one has not been assigned to me. Now, there is always, always a possibility with two seperate networks, to have the same IP address on both networks. I was looking to use one NIC for data off of one network, and the other NIC for data off of the second network. I very much understand there is a difference between serial, and ip based communication. I guess the reasoning for the want to use the NICs seperately, is to eliminate the possibility of false data.

    EDIT: I do appreciate the replys.

  10. #10
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    229

    Re: Using two ethernet adapters

    I still don't understand completely the purpose of binding to a specific NIC.
    Are you saying that your program will be acting like a bridge?
    Even in that case, you can easily find out from which NIC the data come from by checking the sender's IP (RemoteHostIP property).

  11. #11
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Using two ethernet adapters

    Windows will sort all of that out for you though... any data sent to your PC from one specific network will be routed to the relevant NIC.
    As for having the possibility to have the same IP on both networks, that would only happen in the following cases:
    Both of your separate networks are using the same subnet (bad idea)
    You manually set a static IP on one NIC that is the same as the IP on the other NIC

    Are either of those scenarios ever going to happen?
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  12. #12
    Addicted Member
    Join Date
    Jun 2009
    Location
    C:\Windows\SysWOW64\
    Posts
    229

    Re: Using two ethernet adapters

    The scenario of manually setting the same IP to both NICs is not possible (at least under Windows). If you attempt it, the system will "complain" that the specified IP is already assigned to another network adapter.

  13. #13
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Using two ethernet adapters

    ah clever, never tried it because it would be such a stupid thing to do
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  14. #14

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Re: Using two ethernet adapters

    The NICs would not be set the same. And this system will be an hour away from me. I have control over one side, but I do not have control of what happens on the second network. No it will not be used as a bridge. On my controlled network, I will be broadcasting time, synchronised from a gps serial time clock (stratum 1 I believe) that does not have a built in NTP. And also receiving set alarms. Which will then need to be sent over the second network that has internet connectivity. This also will end up doing some site monitoring of data that also comes in via serial data. Which will have to go over the second network. The more I think about it, I suppose windows will do the job, I was just looking to eliminate all possible sources of bad data.

  15. #15
    Pro Grammar chris128's Avatar
    Join Date
    Jun 2007
    Location
    England
    Posts
    7,604

    Re: Using two ethernet adapters

    Yeah Windows will sort all that out If your program is working on this 10.0.0.X subnet and the other network is a totally different subnet then you havent got a thing to worry about.
    My free .NET Windows API library (Version 2.2 Released 12/06/2011)

    Blog: cjwdev.wordpress.com
    Web: www.cjwdev.co.uk


  16. #16

    Thread Starter
    Junior Member
    Join Date
    Apr 2009
    Posts
    18

    Re: Using two ethernet adapters

    Yea, I believe its in the 192.xxx.xxx.xxx subnet, but I do not know for sure. And will not untill the information is provided to me. Thank you for the suggestions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width