|
 |
|
|
do you know how to code a website like ebay.com other website lke that.contact me at jr_jamesrobert01@yahoo.com
|
| Sign In·View Thread·PermaLink | 1.00/5 (2 votes) |
|
|
|
 |
|
|
 |
|
|
A way to get the local IP address that would be used to connect to somewhere without having to connect.
So if you have a machine that has a bunch of IP addresses, you can open a TCP connection and then query your IP address from the connection information.
But What I'd like to see is a way you could query the system to give you the local IP address that it would use to connect to a remote address.
-M
|
| Sign In·View Thread·PermaLink | 1.20/5 (2 votes) |
|
|
|
 |
|
|
I spent quite some time on figuring out why my code (which resembles the code given in this article) wouldn't work on 'all' computers.
The retrieved IP address was "::1". This appears to occur on computers with IPv6 enabled and "::1" is the internal loopback address, which can be used for testing. It is not the IP address which I was looking for.
The array of IPAddress's will have this IPv6 internal loopback address as first 'unusable' entry for IPv6 eabled systems whereas this first entry used to be the address we were looking for. I see a lot of code, also here on codeproject, which relies on the fact that the first IPAddress array entry is OK, thay all just take addr[0] as found IP address.
For your code to be IPv6 'compliant' (not fully, that is quitte something different, but at least compliant for IPv6 tunneling systems) you must check if the found address is the one you looking for.
Check on AddressFamily is not) InterNetworkV6) and IPAddress.IsLoopback.
Hope this saves you my headaches on this issue...
As an example...(a bit of a mess, but it serves it's purpose)....
public string getAddress() { // First get the host name of local machine. String strHostName = ""; strHostName = Dns.GetHostName();
// Then using host name, get the IP address list.. IPHostEntry ipEntry = Dns.GetHostEntry(strHostName); IPAddress[] addr = ipEntry.AddressList;
log("Local host name: " + strHostName); // address must be IpV4 (for our appl.) and not the loopback address for (int i = 0; i < addr.Length; i++) { log(" IP Address[" + i + "]: " + addr[i].ToString()); if (addr[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetworkV6) { log("-----!! IpV6 address"); } if (IPAddress.IsLoopback(addr[i])) { log("-----!! loopback address"); } }
string selectedAddress = String.Empty; for (int i = 0; i < addr.Length; i++) { if (addr[i].AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6) { if (!IPAddress.IsLoopback(addr[i])) { selectedAddress = addr[i].ToString(); log(" using: " + selectedAddress + " (index: " + i + ")"); break; } } }
if (selectedAddress == String.Empty) { log("!!! No useable network addres found !!!"); }
return (selectedAddress); }
|
| Sign In·View Thread·PermaLink | 4.67/5 (5 votes) |
|
|
|
 |
|
|
Hai, i want to get system information including all hardware and software devices. i don't have any idea about this module. Can anybody guide me how can i get such data using codings in .net framework
|
| Sign In·View Thread·PermaLink | 1.33/5 (3 votes) |
|
|
|
 |
|
|
Hi.
I was wondering if there is a way to use the same routine to get all the available IP address in a given LAN using the same codes?
Will someone please show me how? Thanks
|
| Sign In·View Thread·PermaLink | 1.60/5 (10 votes) |
|
|
|
 |
|
|
I tried running the code below but it doesn't give me the IP address I need for my Barcode Network Printer.
DirectorySearcher srch = new DirectorySearcher(); DirectoryEntry entry = srch.SearchRoot; string domain = (string)entry.Properties["name"][0]; //DC name
DirectoryEntry DomainEntry = new DirectoryEntry("WinNT://" + domain); DomainEntry.Children.SchemaFilter.Add("computer");
// To Get all the System names And Display with the Ip Address foreach (DirectoryEntry machine in DomainEntry.Children) {
string[] Ipaddr = new string[3]; Ipaddr[0] = machine.Name; // string guid = machine.Guid.ToString();
System.Net.IPHostEntry Tempaddr = null; Console.WriteLine(">" + Ipaddr[0]); // + " " + guid); try { //Tempaddr = (System.Net.IPHostEntry)Dns.GetHostByAddress(machine.Name); Tempaddr = (System.Net.IPHostEntry)Dns.GetHostEntry(machine.Name); //GetHostByName( } catch (Exception ex) { // IPx.Add(machine.Name); continue; } System.Net.IPAddress[] TempAd = Tempaddr.AddressList; foreach (IPAddress TempA in TempAd) { Ipaddr[1] = TempA.ToString(); //if (Ipaddr[1].ToString() == "10.25.1.222") { Console.WriteLine("found sato printer."); break; }
byte[] ab = new byte[6]; int len = ab.Length;
// This Function Used to Get The Physical Address int r = SendARP((int)TempA.Address, 0, ab, ref len); string mac = BitConverter.ToString(ab, 0, 6);
Ipaddr[2] = mac;
}
Console.WriteLine("\t\t" + Ipaddr[2].ToString().Trim() + "\t " + Ipaddr[1].ToString().Trim() + "\t\t " + Ipaddr[0].ToString().Trim() + " ");
}
I believe this code is all about searching for the assigned computer ip connected to the network. But my real question is,Is there a code in C# that actually searches for all the assigned network including hosts addresses? Its more than a week since I have been trying to solve this problem..
Can anyone willing to challenge my question?
Thank you and Happy New Year to all!!
you can also email me at janverge@gmail.com
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
first of all thank you very much,
you said "The information returned includes multiple IP addresses and aliases if the host specified has more than one entry in the DNS database"
One day I have queried the DNS and returned more than one IP, my machine was then named "TOSHIBA", I changed it to some thing like "my000000" then I logged in to the network and query the DNS again and the result was only one IP which is my machine IP address. How do you explain this and how can I identify my machine IP in case it returns more than one IP.
|
| Sign In·View Thread·PermaLink | 2.33/5 (5 votes) |
|
|
|
 |
|
|
Hello..
i was woundering how can i make my computer a client and a server at the same time, and how can i make sure it works?  
|
| Sign In·View Thread·PermaLink | 2.00/5 (3 votes) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
Is it possible to know if an IP address is associated with a LAN or a direct cable connection( for e.g. a USB host to host connection)
|
| Sign In·View Thread·PermaLink | 2.33/5 (3 votes) |
|
|
|
 |
|
|
This code would not work after copy/paste into framework 2.0 They changed class name from DNS to Dns
renton
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
 |
|
|
Hi, I use Dns.GetHostByAddress to get a computer name from a given IP address. I need to make a list of computers with IP address xxx.yyy.zzz.* (the last byte is variable) in my domain. I'm doing in in following (I admit silly) way: I'm trying all 256 possibilities xxx.yyy.zzz.0-xxx.yyy.zzz.255 and passing them as argument to GetHostByAddress If there is any computer with IP address xxx.yyy.zzz.aaa I'll get its name by Dns.GetHostByAddress(xxx.yyy.zzz.aaa). But if there is none, then GetHostByAddress lasts too long time (more than 3 seconds).
How could I avoid this? If there is any way.. I tried WinSock function gethostbyaddr and it's the same case (they're maybe identical)
Thx for any help..
stej
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hello! Is it possible to get a calback when the ipaddress of the computer is changed? and if it is how do i do that?
Thanks Naveen for this simple and very short solution.
\Frisken
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Thank you for your sample! its great, i had to know what the local iP adrress was for a c# webserver application. Thank you!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
// This was cut & paisted from the MSDN Library... // I think this is what some of you are looking for:
s.Connect (lep);
// Using the RemoteEndPoint property. Console.WriteLine ("I am connected to " + IPAddress.Parse (((IPEndPoint)s.RemoteEndPoint).Address.ToString ()) + "on port number " + ((IPEndPoint)s.RemoteEndPoint).Port.ToString ());
// Using the LocalEndPoint property. Console.WriteLine ("My local IpAddress is :" + IPAddress.Parse (((IPEndPoint)s.LocalEndPoint).Address.ToString ()) + "I am connected on port number " + ((IPEndPoint)s.LocalEndPoint).Port.ToString ());
|
| Sign In·View Thread·PermaLink | 1.67/5 (6 votes) |
|
|
|
 |
|
|
How To Know Machine's Name When "Net Send Anynoumous" Please Giev Me Please Give Me Thank You Very Much Thanks Very Much
|
| Sign In·View Thread·PermaLink | 1.17/5 (5 votes) |
|
|
|
 |
|
|
i am newbi. but i don't know how to fix again with the string strhostname =new strhostname(""). it's like it can't be zero arguments .
please give me some advice
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
 |