Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My problem is fairly simple: I wish to send/receive simple commands between two PCs. The first PC (PC1) runs a program that controls and monitors an alarm system. The seconds PC (PC2) is any PC that is connected to the internet and must be able to also control and monitor the alarm system.

A Java program runs on PC1 and this program monitors and controls the alarm. I therefore have to find a way to control this program remotely. I do not want to use remote desktop as I need to limit the amount of data transfer. I just want to be able to send/receive commands to/from PC1. The program on PC2 can either be a stand alone program or a web app. I'm not sure what would be the best/easiest option to implement. Any comments would be appreciated.

So far, I have come up with the following options:

  1. PC1 acts as a server and opens a socket for the PC2. PC2 connects to the sockets and starts to send commands and then receives responses. I think firewalls and IP addresses can be be a problem
  2. Create a server program that runs on a server on the internet somewhere. PC1 and PC2 would then be clients that communicate with each other via the server. I think this is the best solution, but I have no idea how to implement this.
  3. Use Google App Engine as the server and somehow relay information between the two PCs.

I've done a lot of research, bit still I don't know what is the best way to implement this. I am planning on writing the programs in Java. I have good programming experience, but my knowledge regarding networks are very limited. I would also have the add a password to log in and ideally encrypt the transmitted information.

Any comments regarding the above options or any other method to solve my problem would be greatly appreciated.

Thanks

share|improve this question
    
This really seems more of a question for stackoverflow instead of serverfault –  Aaron Aug 8 '11 at 17:51

1 Answer 1

Depending on the design of the Java program and the oporating system you are working with the solutions might already be at your finger tips. Using something along the lines of SSH to get a command shell on the remote machine that would allow you to send the comands to the alarm monitoring program and veiw the responces would probably be a good starting point. Without more specific information on the enviorment you are working with that is my best advice. If the alarm monitoring program has an API tieing it to a very simple secure client/server interface program would not be too hard.

share|improve this answer
    
I must still write the java program that runs on PC1 as I'm designing the whole system. Let me explain it in a different way: Suppose I have a program that controls the serial port of a PC that is connected to a coffee machine. What would be the easiest/best method to send commands to this program so that I'm able to control the coffee machine via the internet? This is just a simple explanation, but I think the principles are the same. Do you still think SSH is the best solution? Thanks! –  Kritz Feb 27 '11 at 20:22
    
okay well since you are still developing the software you have a world of options. If you want to avoid as many firewall problems with client server as possible then you want something like this. PC1 initiates a connection to a server on the internet the server provides an interface that PC2 can connect to. The interface for PC2 could be a webpage on the server or a socket and API for a clinet program to connect to. The other option would be a simple java client\server application. In eithercase it would be a good idea to encrypt the connection. –  Liam Feb 27 '11 at 20:29
    
A tried a simple java client/server app and it worked well in my home network, but I had firewall problems when I tried it over the internet, so as you said, the server on the internet would be the best option. Having said that, I have more experience in embedded design and little network knowledge. Where would I start to develop such a server application as I have no idea how to implement this? Where would the app be hosted or can I host it myself? I just need a push in the right direction, I think I'll be able to figure it out from there. –  Kritz Feb 27 '11 at 20:53
    
Think about the internet server this way. On one side it is a server that the client on the alarm monitor connects to and sends information to. On the other side it is a server that the client connects to and gets the informationg that was sent to the server. –  Liam Mar 1 '11 at 4:10
    
Thanks Liam, I understand that, but how would I actually implement such a solution? 1. How does the clients communicate with the server? Should I use sockets sockets or http? 2. Can I write the server program in Java or what language should I use? 3. Where can I host this server app? Can I have it running on my own computer or are there companies that provides such a service? –  Kritz Mar 1 '11 at 6:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.