Author Topic: launching a program using network, on another pc ?  (Read 5138 times)

ilimo

  • Not-a-newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
launching a program using network, on another pc ?
« on: May 27, 2006, 01:29:04 AM »
hello,

when making program for a network,
u launch client and server and u make them communicate

1- two pc in one network : pc1  pc2
2- i launch my program on pc1 : how make it run on the pc2( not on the pc1) ?

hope i'm clear

thank u for your help

the_viking

  • Jr. Member
  • **
  • Posts: 97
  • Karma: 2
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #1 on: May 27, 2006, 07:22:03 AM »
So you want to start the program remotely? What type of OS is the other side? If it's Linux, you can probably login by SSH and then start your program as a service. Maybe you can do the same on Windows using telnet. Anyway, better give control to the user wether to start your Program or not, you'll have to run any program anyway on the other side which then DOES start the other (your) program.

wrt

  • Full Member
  • ***
  • Posts: 139
  • Karma: 0
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #2 on: May 27, 2006, 09:07:41 AM »
there are also some ssh servers for windooze.

ilimo

  • Not-a-newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #3 on: May 27, 2006, 05:35:02 PM »
i'm the only user of this network

my os : windows xp pro
i use only visual c++ and c++

this program is a win32 console using MFC
makes additions and print them on the screen

i launch the program on pc1 but must run on pc2

any help ?

Rackle

  • Not-a-newbie
  • *
  • Posts: 23
  • Karma: 1
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #4 on: May 28, 2006, 08:00:14 AM »
My small home network has 3 computers but only 2 keyboard and 2 monitors.  I'm using WinXP's Remote Desktop to control the third computer i.e. manually starting applications.

You could also place your program into the Startup folder so that it automatically executes when you boot the PC.  If that program is a peer-to-peer then it is very simple (with Raknet) to connect to it and give it an instruction to perform the additions.

ilimo

  • Not-a-newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #5 on: May 30, 2006, 05:18:21 AM »
when u use "WinXP's Remote Desktop "
u must configure your pc

ex: pc1 is configured to accept remote connections

from pc2 u try to do it

in this  case, u must close your currently opned cession on the remote pc1
and then try to open another one from the pc2
//////////////////////////////////////////////////////

but on pc1 my currently opened cession must stay opened

and i want to launch my program from pc2 on the pc1

//////////////////////////////////////////////////////////////////////////

hope i 'm clear

thank you
 :-\

ilimo

  • Not-a-newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #6 on: May 30, 2006, 05:40:04 AM »
even if i use VNC
it couldn't work

on pc1 i have a program running in full screen

so i can not see my desktop

so i can not acces my program
//////////////////////////////////////
when i connect VNC,
and then launch my full screen program
VNC disconnect
//////////////////////////////////////////

so still the same problem

2 how launch a program on a remote pc using a network ?

OvermindDL1

  • Anti-Spam Moderator
  • Hero Member
  • ****
  • Posts: 855
  • Karma: 40
  • Programmer
    • View Profile
    • OvermindDL1's Site
Re: launching a program using network, on another pc ?
« Reply #7 on: May 30, 2006, 05:11:05 PM »
You should be able to use Termserv or VNC to do it, I use both.  The cheap one line command way is to use the "at" command to tell a program on a remote pc to start a couple seconds from now ('at' accesses the scheduler on local or remote pc's, you have to pass in a user/pass as well, type "at/?" on the command line to see its options.

Rackle

  • Not-a-newbie
  • *
  • Posts: 23
  • Karma: 1
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #8 on: May 30, 2006, 05:43:11 PM »
You are at PC1, start a program, and want a program to also start on PC2.  The ONLY way this can work is for PC2 to have a _server_ program already running on PC2.  This _server_ can be a service like Remote Desktop, PcAnywhere, or even the Microsoft Remote Assistance.  Other _servers_ already mentioned include Termserv, VNC, SSH, and telnet.  Since none of these are adequate then maybe you need to build your own server:

client.exe
RakClientInterface *client=RakNetworkFactory::GetRakClientInterface();
char message[2048];
strcpy(message, "MyProgram.exe");
client->Send(message, (int) strlen(message)+1, HIGH_PRIORITY, RELIABLE_ORDERED, 0);


server.exe
RakServerInterface *server=RakNetworkFactory::GetRakServerInterface();
Packet* p;
unsigned char packetIdentifier;
char message[2048];
while(true)
{
  Sleep(30);
  p = server->Receive();
  if (p==0)
    continue;
  packetIdentifier = GetPacketIdentifier(p);
  system(p->data);
  server->DeallocatePacket(p);
}

Disclaimer 1
This code is incomplete and will not compile...  It's only meant as a starting point to allow you to write the client and server code that would allow you to execute a program on a remote PC.

Disclaimer 2
This is my very first Raknet code.  I used the code presented in "Chat Example Server.cpp" and "Chat Example Client.cpp".

sdi

  • Not-a-newbie
  • *
  • Posts: 43
  • Karma: 0
    • View Profile
Re: launching a program using network, on another pc ?
« Reply #9 on: June 07, 2006, 05:28:05 AM »
Hi there,

take a look at http://www.sysinternals.com/Utilities/PsTools.html. There you find a tool callled PsExec - it remotely starts applications. You specify the program (.exe) and the computer on which it should be started.

I reprogrammed this tool for my work. It uses services to start remote applications.

[1] Copy service to the remote computer
[2] Start service by using the service manager of Windows XP and pass application name (as command line parameter). If necessary copy application (.exe) to the remote computer previously
[3] The service is started on the remote computer and only needs to start the requested application.

If the application uses GUI it's a little bit more tricky. The service needs to get access to the local window station, ... but if you're searching the web you will see how. There's an example in MSDN help of Visual Studio too I think.

Hope that helps.

Regards