2

I am looking to write a program that will connect to many computers from a single computer. Sort of like "Command Center" where you can monitor all the remote system remotely on a single PC.

My plan is to have multiple Client Sockets on a form. They will connect to individual PCs remotely. So, they can request information from them to display on the Window. Remote PCs will be hosts. Is this possible?

mjn
  • 36,362
  • 28
  • 176
  • 378
ThN
  • 3,235
  • 3
  • 57
  • 115
  • What kind of monitoring? Surveillance? System Performance? Date/Time? The weight of your "monitoring" will define your requirement for scalability. – Jerry Dodge Sep 26 '14 at 02:06
  • Agree with Jerry. Without an answer to these questions there are too many unknown variables. – Gabriel Sep 27 '14 at 12:32

3 Answers3

3

Direct answer to your question: Yes, you can do that.

Long answer: Yes, you can do that but are you sure your design is correct? Are you sure you want to create parallel connections, one to each client? Probably you don't! If yes, then you probably want to run them in separate threads.

If you want to send some commands from time to time (and you are not doing some kind of constant video monitoring) why don't you just use one connection and 'switch' between clients?

I can't tell you more about the design because from your question is not clear about what you want to build (what exactly you are 'monitoring').

VERY IMPORTANT!

Two important notices to take into account before designing your app (both relevants only if the remote computers are not in the LAN (you connect to them via Internet)):

  1. If the remote computers are running as servers, you will have lots of problems to explain your customers (if they are connected (and they probably are) to Internet via a router) how to setup the router and the software firewall. For example, if a remote computer is listening for commands from you, on port 1234 (for example) the firewall in the router will block BY DEFAULT any connection attempt from a 'foreign' computer (from you) to that port.
  2. If your remote computers are running as clients, how they will know master's IP (your IP). Do you have a static IP?
Gabriel
  • 20,797
  • 27
  • 159
  • 293
  • 3. If you do have a Static IP, do you have a domain name that you can possibly point a sub-domain to that IP? (+1) If one day you decide to move your server to a different IP, you would also have a nightmare. DNS can solve that. – Jerry Dodge Sep 26 '14 at 02:19
  • 2
    The question is about connecting to hosts (servers), your answer is about connecting to clients. Also, opening a firewall port is not "rocket science", I would not say it gives ´*lots of problems*´. – mjn Sep 26 '14 at 06:37
  • 1
    @mjn-When it is about your own router it is not a rocket science indeed (even though I had two routers that refused to work... so many routers today have buggy software). But it looks like he needs to deliver the application to random users. In this case, a 'click and run' solution is impossible, because of the routers. He will have to explain to the user how to configure the router. And each router has its own setup procedure. – Gabriel Sep 27 '14 at 12:26
  • 1
    @mjn-As explained, if he wants the clients to connect to his 'master' computer (he is the server) then his computer needs to have a static IP. – Gabriel Sep 27 '14 at 12:27
2

What you actually need is one ServerSocket on the module running on your machine. To which all your remote PC's will connect through their individual ClientSocket.

You can make your design other way round by putting ClientSocket on the module running on your machine and ServerSocket on the module running on remote machine.

But you will end up creating one ClientSocket to each ServerSocket, what if you have the number of remote servers increase.

Now if you still want to have multiple ClientSockets on your machine then as Altar said you could need a multi threaded application where each thread is responsible for one ClientSocket.

user1897277
  • 485
  • 4
  • 13
0

I would recommend Internet Direct (Indy) as they work well in threads, and you can specify a connect time-out per connection, so that your monitoring app will be able to get a 'negative' test result faster than with the default OS connect time-out.

Instead of placing them on the form, I would wrap each client in a class which runs an internal monitoring thread. More work initially but easier to keep independent from each other.

mjn
  • 36,362
  • 28
  • 176
  • 378