0

I have a Program which is written in C++. It is a program which needs to be restarted when network connection is lost ...

I have written program code which is pinging IP and I'm stuck on that ...

Can anybody show me the code for the next step

Thank you beforehand.

sbi
  • 219,715
  • 46
  • 258
  • 445
  • 1
    Why do you want to restart your Program when network connection is lost? Shouldn't you reopen your network connection? – Arthur Sep 28 '09 at 09:20
  • there is server and all of the computers are connected in one IP when network is lost i want to restart the program .. – Tornike Sep 28 '09 at 09:27

2 Answers2

0

You need to create a separate program which monitors your program, and starts it if it stops.

Lars D
  • 8,483
  • 7
  • 34
  • 37
0

It's been a while since I wrote C++, so I'll present this as pseudo code:

if (network connection lost)
{
    Process.Start("C:\Program Files\This Program\program.exe");

    // exit this application
}

C++ Process.Start documentation

ChrisF
  • 134,786
  • 31
  • 255
  • 325