See all PC's on my network

Hi,

My app sits on a shared Windows XP PC, which acts as a 'server' to a small office network.

I need the ability for my client apps, on the network, to locate the 'server' and populate a textbox with the 'server's' name. Can anyone point me to some code that does this, please.

Thanks.
tvtechAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AegilCommented:
If the computer is being used as a server why dont you just set it up on a static ip address and use that as the reference in your application, or just the machine name. Unless you are wanting that the server changes frequently, I know in standard server / client apps you would want a fixed server name / ip usually. Further to that, the computers name (i guess you mean hostname) shouldnt really change regularly.
0
kbireckiCommented:
Aegil is right, you would normally set the server to be something static - so that you always know what it is.  So when you think about "acts as a 'server'", what is the definition of "server" in this case?  Literally.  Does it run a certain piece of software?  If so, maybe you can have to do something that announces itself as the "server".  And to do so, you'd have to have a common place/method to make that announcement.  For instance, if all workstations share a common network drive, such as F:\, then you could say that all clients agree to look at F:\Server.txt, read the contents to find out what they need to know to identify the server. Then you jst work backwards and make your server setup that file when it starts, effectively announcing, "I'm the server."
0
tvtechAuthor Commented:
Sorry guys, I should have said that my Client apps all need to locate the server app. Something along the lines of listing all network PC's in a listbox and letting the user select the 'server' PC, so that my client apps can all talk to the 'server' app.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

AegilCommented:
so are you going to have servers on every single pc and a client on every single pc?
And then you want the client to be able to find a list of all pcs with server apps running on them and then allow the user to be able to connect to the specific one they want?

Could we ask what your app is for? or an idea of what its supposed to do?
0
tvtechAuthor Commented:
No. One PC acts as a server, which carries a mySQL database. The client PC's, using ADO, access that mySQL DB, but they (Clients) need to know where the server is, without user interaction.

The idea is that once the server app is installed, it will drop a file into it's folder, with the PC name contained within it.

As each client app is installed, it looks for the file that resides in the server folder. It then knows the permanent server name, so that it can be used in the mySQL connectstring.

Thanks.
0
AegilCommented:
It seems a lot more work than simply having a set name . All you really need to do is program your software to auto install with a default server hostname. You can just call the server pc SERVER as a hostname and get your software to use that. I mean if its just one server, just set that server as a static IP and a set hostname and then proceed based on that if its just a case of one site that will use this application.

For example in a windows environment where you dont have AD and are connecting to an exchange server. for example when a user uses there own laptop they would put in the server name to configure there mailbox anyways. I would probable recommend you just set your software to try a default name, set the server to use that same name. And have a feature for updating the server name in your software.

I mean the way you seem to be wanting to do it, your going to have your server drop a file into its folder, the application is going to scan the network for a shared folder or some application socket to retrieve the hostname to then populate the ADO connection string automatically.
0
tvtechAuthor Commented:
Thanks, but it will be a number of sites, most of which will be too far for us to visit and setup.

Yes, it does seem like a lot of work, but bear in mind that good software is not always based on the easiest, or safest approach, from a programming perspective. :-)

Our apps talk to each other, via both local and Net based mySQL databases. We need to minimise user interaction, due to the fact that they are complete novices. Setting up static IP's is not an option, due to user lack of knowledge and possible unknowns.

Thanks.
0
kbireckiCommented:
I may have a solution that find all pc's on a network and populated a combo box, but I'll be away from my computer until later tonight.  I'll try to post it as soon as I can.
0
kbireckiCommented:
Here is the sample I used to make an app that loads a list of all computers on the network.  And it's pretty fast, even over a VPN.

http://www.daniweb.com/software-development/visual-basic-4-5-6/code/216297

(It's attached for reference purposes.)
basGetComputers-v2.bas
0
kbireckiCommented:
I forgot that I was going to clarify that I originally modified the sample to load a combo for my purposes, but the original populates a ListBox (instructions are on the original site and in the file I uploaded.)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.