Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems Retrieving All IPs from Remote Computer

Status
Not open for further replies.

Galarun

Programmer
Jun 28, 2005
24
US
Hello, this is my first time posting here so treat me nicely :).
My question is that I'm using System.Net.Dns.GetHostByName("Name") and it's only returning the primary IP address for each computer even though some of them have more than one address. Is there something I'm doing wrong? Is there a way to get all the IP addresses by using Sockets? If someone would explain this to me it would be greatly appreciated, thanks!
 
It's querying the DNS for this information, and it sounds like the DNS server only lists one of the interfaces available for that machine.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
I understand that but the thing is is that if I request the IP Addresses from my own computer it will return all of them, but none for any other computer. Do you have any idea how I can remedy this?
 
Chip is right, you are only querying the active connection. You will need to dig deeper than the DNS layer to find connection info.

Is this a web connection, terminal services, or what?
 
I'm trying to find all the IP Addresses of all the computers over a LAN. I can ping each address but I can only retrieve the primary IP Address using the System.Net.Dns.GetHostByName function. I've been trying to use Sockets to create a connection but my knowledge on those is pretty slim. I'm quite at a loss here so any ideas of how to accomplish this would be awesome. Thanks!!
 
This may be something that gets exposed by WMI. Take a look at the systems management classes.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Hey, thanks for the help!

I checked out the systems management classes and found what I was looking for. I can now retrieve all the ip addresses from a computer on the same domain. However, I can't connect to computers on another domain and I keep getting the error "RPC Server is unavailable" whenever I try to connect. I know there's nothing wrong with my code after slaving over it for hours on end. I figured out that there are no trusts between the domains here and that is probably what is causing the problem. Unfortunately, because I'm at work and don't have total control over the domains I can't create any trusts. They don't want to create any because in Windows 2000 trusts are always transitive between domains in a forest, so they don't want a two-way trust going on.

My question is, is there any other way of connecting to the computers in another domain and get there IP Addresses without creating any trusts? Is there a specific control I need to configure that will allow only netbios information to be passed along? Thank you guys so much for your help, seriously!
 
Anybody out there know the answer to this? I'm in desperate need of advice for I've tried pretty much everything. I can only run the program from my computer so I can't use sockets to get the addresses, and the computers in the other domain don't and can't have RAS enabled because of safety issues. Any advice would be greatly appreciated!
 
Is it possible to run a small applet on the remote computers that report their own IPs to you, rather than you trying to pull them?
 
Well, technically I could, but I'm not sure I have permission to do that here and I won't until Monday when my supervisor comes back (plus I'm an intern, so that doesn't help =P).

My goal is to do this only using the program on my computer, but I'm beginning to think it isn't possible unless RAS is enabled on the other computers, which they aren't (and can't like I said above).

The thing is is that if I'm logging into the other domain with an administrator from that domain (but running the program from my computer on a separate domain) then why am I still not able to access the computers there? I suspect it's becuase of RAS being disabled, but in my head it just doesn't make sense ('cause if I'm logged into the domain with an administrator from that domain, then why doesn't he have access to anything?).

Just curious, though, if I were to create an applet to put on each computer (which I might if I have the permission) how would I set it up? Would I have to host it in a browser? Or could I just use sockets to create a connection? I'm sorry for all the seemingly pointless restrictions that make this so difficult, but it isn't my fault my co-workers assigned me this project when it might not even be possible with the current domain setup.

Anyway, thanks again for the replies and if you have any more advice I'd be more than happy. Well, off to try and find another answer...
 
Ever done Windows Update? The first time, it looks for the applet and if it doesn't exist or it is old, it downloads it for you. You don't have to go that fancy, you can just make everyone download it (as long as you have permission). Then I would recommend a webservice? You will talk through port 80 (TCP/IP) which you definately have permissions for. The webservice can then control the input from the remote machines.

You'll have to do some research into this but it could be a simple solution for you.

If someone else reads this and finds anything incorrect about what I said please feel free to let us know!

As for being an intern... it's good experience. We all face things like this. Eventually, it gets easier.
 
Hehe, yeah being an intern at a small company for programming is actually pretty sweet. I've learned more here in the past month and a half than any class I've taken on programming. As for this problem, it turns out that I only need to get the addresses for a set of computers in only one domain, so instead of connecting between domains we're just going to put this project onto the other domain so it can retrieve the addresses with no problem.

Thanks again for all your advice!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top