CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Remote Rebooting

    Hey,

    How would I got about allowing people to connect to a program to reboot a program that may have crashed or needs to be restarted? Some tell me you can use system(), which I am unfamiliar with.

    Any help is appreciated. Thanks.

  2. #2
    Join Date
    Mar 2004
    Location
    (Upper-) Austria
    Posts
    2,899
    you may write a application that listens at port 8732 for example and another program that connects at this port. so the connector sends like "KILL wmplayer.exe" to the listener and the listener closes the program. this all works with sockets/client/server ...

    wanna code?
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

  3. #3
    Join Date
    Oct 2003
    Location
    Philadelphia, PA
    Posts
    167
    I wonder what OS you are using for this? You may not even need to code something. For example, if you're on windows, there are services available for helping you to do this.
    Mike Dershowitz
    miked@lexientcorp.com
    www.lexientcorp.com

  4. #4
    Join Date
    Mar 2004
    Posts
    2
    I got the rebooting thing working. Though I think it would work better for PHP or whatnot.

    I use Windows XP. What options do they have which help in this situation?

  5. #5
    Join Date
    Nov 2003
    Posts
    101
    Check out www.sysinternals.com under the utilities for your OS and download PSTools. Should do most of what you want I think.

    - Tom

  6. #6
    Join Date
    Dec 2005
    Posts
    10

    Re: Remote Rebooting

    well you can just use "taskkill" command
    and capture the output in array and display it
    Code:
    <?php
    session_start();
    ?>
    <body bgcolor="#000000"><font face = Fixedsys color="#CCCCCC" >
    <title>C:\WINDOWS\system32\CMD.EXE</title>
    <?php
    if($_SESSION['pass'] == "ok")
    {
      if(isset($_GET['mode']))
      {
       echo "C:\>".$cmdl."<BR>";
       $cmdl = $_POST['cmdl'];
       exec($cmdl,$second);
       $second = implode($second, "<BR>");
       $second = str_replace("<","&#60;",$second);
       $second = str_replace("&#60;BR","<BR",$second);
       $second = str_replace(" ","&nbsp;",$second);
       echo $second;
      }
       echo "<BR><A NAME=\"bott\"><form name=\"myform\" method=\"post\" action=\"?mode=do&_#bott\" >
       C:\><input type=\"text\" name=\"cmdl\" style=\"border: 0; background-color:#000000; font-family:Fixedsys; color:#CCCCCC;\" size = \"50\" ></form>";
    }else{
      echo "<center>
    
      page 'PROTECTED'</center>";
    }
    ?>
    </font>
    </body>

  7. #7
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Remote Rebooting

    Quote Originally Posted by Rojay
    well you can just use "taskkill" command
    and capture the output in array and display it
    Why do you post a piece of PHP code on a C++ question?
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured