Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 08-13-2009, 05:32 AM   #1
Registered: Jul 2009
Posts: 43

Rep: Reputation: 15
How to keep operation running when server's program is closed

I have a server computer and a client computer.
The client computer processing information from server computer and running operation. Server computer gave commands to client computer to control its operation.

Server and client computer are connected using wireless network.

We have programmed the client computer to continue the operations set even when the wireless network terminated or disconnected (with the condition that the server computer program still active) until the operation is complete or it receive other commands.

The client computer will continuously search for reconnecting the network itself. The server and client computer network through wireless can be connected back without interrupting client computer's current operation until the server computer is giving another command as server and client computer are sharing the same ip address and port number.

The problem now is

when the server computer program is closed or shut down, the client computer and server computer can no longer automatically or manually connected to each other without first terminating the client's ongoing operations.

When we attempt to connect the client computer back to server computer, it is not successful. This is due to the server computer can no longer use the same port number that the client computer is using as it is not allowed. We need to terminate the client computer operation and establish connection between them first. Then, only we can start our work from the beginning.

How can we solve this? How to make the client computer continue running on its own following the preset operation and without interrupting the client computer operation, connect the server and client back using the same ip address and port number?
Old 08-13-2009, 09:45 AM   #2
Senior Member
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Hi eryn,

Please correct me if I'm wrong but you mentioned the server and client are sharing the same ip address ?? .. this may cause you some trouble as 2 hosts on the same network need to have unique addresses.

Assuming you get the addressing sorted out.. one of the simplest ways to kick off a job on one host from another is to install 'screen'. The process to use screen looks like this:

1. ssh from host_a to host_b
2. run 'screen'
3. run the command you desire, backgrounding is not necessary
3. press '[ctrl]+A D' to detach from the screen session
4. logout

To check on the job later:

1. ssh from host_a to host_b
2. run 'screen -ls' to list your screen sessions ( you may have more than 1)
3. run 'screen -r' or 'screen -r session' to reconnect
4. exit or detach again depending on job status


Old 08-13-2009, 09:33 PM   #3
Registered: Jul 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Hi kbp,

Maybe I am not explaining clear enough.
Actually, the client computer and the server computer on their own has a unique ip address.
The client computer will 'telnet' to the server computer using the server computer ip address to connect.

We have a chat window in the server computer to give command.
When this chat window is closed, the connection between client and server is terminated.
The client computer suppose to continue running all the command written in program.
However, it will hang at the last command it executes. For example, if the last command it is running before the chat window is closed is turning motor CW, then it will turn non stop until we cut off the cable connection between the motherboard and the Bus system.

When we reopen the chat window and try to connect back to the client computer, we are not allowed to do so. The error message shown said that the port number already in used and each port number can only be used by one people, thus we cannot connect.
Old 08-13-2009, 09:37 PM   #4
Registered: Jul 2009
Posts: 43

Original Poster
Rep: Reputation: 15
Well, my colleague just found out the solution.
It is just a very minor change.

When the chat window is closed, a value of 0 is return to the program.
In our program, in order to connect back the operation, we put the condition as

Therefore, the command underneath this condition can never be executed.

Thus, we have change the condition to (returnresult<=0)

Anyway, thank you kbp.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
using the same program with two operation systems fke_2020 Linux - Newbie 7 05-08-2008 04:06 PM
Copy/Paste operation after window closed? SlowCoder Linux - Newbie 8 05-07-2007 07:06 PM
RAID-1 / After the server's already running! Metal-X-Man Linux - Software 9 03-26-2005 09:25 PM
How to shutdown after a specific program is closed tlilja Linux - General 2 02-23-2005 09:03 AM
Running program when terminal closed? mikeshn Linux - General 9 11-23-2002 08:00 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:54 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration