473,326 Members | 2,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Which Ethernet card is being used?

Hello,

If I have several ethernet adaptors with different IP addresses on my system
and do the following (or something similar to an arbitrary non-Internet IP
address), how do I know or control which of those cards is being used?

TcpClient tcpClientB = new TcpClient("www.contoso.com", 11000);

Thanks,
Ray Mitchell
Ra*********@MeanOldTeacher.com


Nov 15 '05 #1
1 1794
Hello

The TcpClient class has an overloaded constructor that takes an EndPoint as
a parameter

TcpClient tcpClientB = new TcpClient(new
IPEndPoint(IPAddress.Parse("10.0.0.1", 0)));
tcpClientB.Connect("www.contoso.com", 11000);

using this constructor you can control which local IP address is used,
therefore you can control which network card is used.

to know which ip address is used use this after the connection is made.
IPAddress ipAddr = ((IPEndPoint)tcpClientB.Client.LocalEndPoint).Addr ess;

Best regards,
Sherif

"Ray Mitchell" <Ra*********@MeanOldTeacher.com> wrote in message
news:tu*****************@newsread2.news.pas.earthl ink.net...
Hello,

If I have several ethernet adaptors with different IP addresses on my system and do the following (or something similar to an arbitrary non-Internet IP
address), how do I know or control which of those cards is being used?

TcpClient tcpClientB = new TcpClient("www.contoso.com", 11000);

Thanks,
Ray Mitchell
Ra*********@MeanOldTeacher.com

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: JC | last post by:
I am very new to programming and learning on my own. Why do I keep getting duplicate values using this code? I want to shuffle a deck of 52 cards. The logic seems right to me. Randomize For...
3
by: Ophir | last post by:
Hi all ! Are there any windows API to get information about ethernet cards installed on the computer? Tried to search msdn but came out short. I need to get all present networking cards...
8
by: Edison Abarca Tapia | last post by:
Hi: I need change MAC(nic) Address. I help me pleaseeeee... thanks, Edison
9
by: nm | last post by:
Hi, I am a developer quite familiar with the C# language and .NET framework. I develop mainly data driven websites. All of our past clients have shopping cart systems developed by me in ASP.NET...
5
by: Peggy | last post by:
Hello, I have a web application running on IIS, What I wanna do is to obtain server's ethernet card's mac address in order to use this address for licensing issues I have developed my web...
2
by: illusion | last post by:
Need help im not either getting da idea how to detect ethernet card and to read data file from it when there is a client server scenerio and server & client both knows eachother's IP address(but in...
2
by: mostafijur | last post by:
Hello My PC has 2 ethernet card.I am using 1 port for internet.The 2nd port is connected with another PC and same network address.I want to send data by the 2nd port to that PC on time...
6
by: Ryan Liu | last post by:
Hi, If I want to uniquely identify a computer. I can read CPU ID or Mac Address. I heard, but is this true: some BIOS can block CPU ID from being read? (In this case, will I get an exception,...
3
by: jh3530 | last post by:
Hello, my apologies for the lame question, but I can't seem to figure this one out. I was recently given a laptop from my inlaws that is running windows 98. I wanted to get internet access on it,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.