If you want to program something that can react to your commands while you are away from your other computer, then here's how to create a server client program. The purpose of having a server connect to the client computer is to get data from the client/remote PC. Or you can also transfer files to the client computer, which are necessary to run another program that is installed in the client/remote PC.

For a program to make remote computers work perfectly, the best way is to create a server and client program. The server program will be installed on the server computer where the professional or the main user will be. While the client software should be installed on all the remote/client computers that you want to manipulate.

Before we start, take note that this kind of programming is under network programming. In order for this to work, the server and client computers should have a network device. These devices include Bluetooth, Wireless LAN, Network Interface Card, etc.

The Server Program

Both the server and client programs should have a component to make way for communications. Sockets can be assigned by the programmer to handle the server and client communications connections. Let us call the server socket an SS(range). As a programmer, you must understand the meaning if a control component's name has a range. It means that there are a multitude of these components. In our example SS(range) can be SS(1), SS(2), SS(3)… SS(n) and so on. The sockets on the server must be numerous to handle communications on different clients.

Listening from the assigned port and waiting for a client connection is a basic job of a server. Nowadays, client/remote PC are commonly online clients (computers that are connected to the server via the Internet). But in some applications, the clients are the one that always listen to the port and wait for the server's connection. In most applications, both the server and the client have an assigned listening port. Because of this, both the client and the server know if either of them needs to connect.
 
When the server hears a client connection request, it should assign an SS(n) socket to handle communications on the specified client. There should be very minimal server code when a client asks for connection. The best code is just "Connect to SS(n)." That way, the listening port will go back to listening immediately to entertain other clients' connections. After a connection between the client socket and the server is made, the SS(n) socket will be the bridge between the two communicating computers.

Using SS(n)'s connection, the server can give any code, command or data to the client without limitation.

The Client Program

During the installation of the client program, the installer should set up all necessary programs to make the client and server connection flawless, including the firewall and antivirus to allow such communication.

The listening socket of a client can be used as the communications socket too, since the client program does not expect any other computer to connect to it. But, of course, the programmer can make alterations depending on the program's requirements. When the connection has been made between the server and the client program, either the client or the server may now send information on each other so that both will know the status of both programs. The server may send commands to the client program and, depending on the code of the client program, the client will execute the commands locally. A request for data transfer may also be sent from the server or from the client and the other will respond (according to the program instructions) accordingly.

The relationship between a server and client program can be compared to slavery: The master (the server) tells the slave (remote terminal) what to do and the latter executes the order without question. Actually, the main idea and purpose of server client programming is simply communication.

Average rating: