[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

See all PC's on my network

Posted on 2011-10-27
10
Medium Priority
?
333 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:tvtech
  • 4
  • 3
  • 3
10 Comments
 
LVL 8

Expert Comment

by:Aegil
ID: 37036680
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
 
LVL 11

Expert Comment

by:kbirecki
ID: 37036890
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
 

Author Comment

by:tvtech
ID: 37036982
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 8

Expert Comment

by:Aegil
ID: 37037068
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
 

Author Comment

by:tvtech
ID: 37037199
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
 
LVL 8

Expert Comment

by:Aegil
ID: 37037292
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
 

Author Comment

by:tvtech
ID: 37037934
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
 
LVL 11

Expert Comment

by:kbirecki
ID: 37041869
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
 
LVL 11

Expert Comment

by:kbirecki
ID: 37042457
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
 
LVL 11

Accepted Solution

by:
kbirecki earned 2000 total points
ID: 37042466
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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question