hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : web interface for C++ program
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

web interface for C++ program

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 09-27-2003, 06:03 PM
xaero xaero is offline
WHT Addict
 
Join Date: Sep 2002
Location: ohio
Posts: 119

web interface for C++ program


does anyone know how i could write a web interface that will all the user to start and stop a c++ program and to enter the server ip address,and show the ouput of the program.

i need this interface for a UDP repeater that myself and some other students are using to broadcast game server's udp broadcasts across VLANS at out university. If anyone knows how to write a web interface that could do that please let me know and ill send your the client and the server source code of the repeater.

email me at pauljusm@notes.udayton.edu

Reply With Quote


Sponsored Links
  #2  
Old 09-27-2003, 07:31 PM
CSD_Hosting CSD_Hosting is offline
Junior Guru
 
Join Date: Dec 2002
Location: UCIrvine, Irvine, CA
Posts: 193
PHP Code:
<?php

// Executes system commands
// and displays output
function docommand($command) {
$out "=============\nOutput\n=============\n\n";
  if (!(
$p=popen("($command)2>&1","r"))) {
    return 
126;
  }

  while (!
feof($p)) {
    
$line=fgets($p,1000);
    
$out .= $line;
        
$out .= "<br>";
  }
  
pclose($p);
  return 
$out;
}

$command "netstat -a -n";

echo 
docommand($command);
// This command executes whatever
// is inside $command, and then
// displays ALL of the output of that
// specific command
// for your app just make
// $command = "yourapp.exe -parameters";

// Mitchell Dempsey
// webdestroya at cox dot net

?>

Note: This command will work on both linux and win32 machines

__________________
(: ˙pɐǝɥ ɹnoʎ uo ƃuıpuɐʇs ǝq ʇsnɯ noʎ uǝɥʇ˙˙˙sʎɐs sıɥʇ ʇɐɥʍ pɐǝɹ uɐɔ noʎ ɟI
Picmember.com - Full Quality Event-Based Photo Sharing
MitchDB: Gameserver Control System

Reply With Quote
  #3  
Old 09-27-2003, 08:41 PM
xaero xaero is offline
WHT Addict
 
Join Date: Sep 2002
Location: ohio
Posts: 119
thank you

thank you, but i was wondering is there any way to pass the command options, like the ip address of the master server is added to the program by passing the program the -s 131.238.x.x option. Is there anyway to do that, and anyway to send an end signal to the program like a ctrl ^c from the linux command line, and make it an option button?

Reply With Quote
Sponsored Links
  #4  
Old 09-27-2003, 08:47 PM
CSD_Hosting CSD_Hosting is offline
Junior Guru
 
Join Date: Dec 2002
Location: UCIrvine, Irvine, CA
Posts: 193
PHP Code:
<?php 

// Executes system commands 
// and displays output 
function docommand($command) { 
$out "=============\nOutput\n=============\n\n"
  if (!(
$p=popen("($command)2>&1","r"))) { 
    return 
126
  } 

  while (!
feof($p)) { 
    
$line=fgets($p,1000); 
    
$out .= $line
        
$out .= "<br>"
  } 
  
pclose($p); 
  return 
$out


$command1"netstat  -s 131.238.x.x"
$command "yourproggie.exe -ip ";

$command .= docommand($command1);
// adds the IP to the end of the command

$realcommand docommand($command);
// This command executes whatever 
// is inside $command, and then 
// displays ALL of the output of that 
// specific command 
// for your app just make 
// $command = "yourapp.exe -parameters"; 

// Mitchell Dempsey 
// webdestroya at cox dot net 


?>
As for CTRL^C and whatnot, im not really sure what you would do, but this command doesnt leave programs running, it displays output after the program has closed, so if you have an infinite loop, you will never see output, infact, the page will never stop loading. you would have to make some sort of service
and use start and stop commands, and make a graphical web
interface to send the service commands

__________________
(: ˙pɐǝɥ ɹnoʎ uo ƃuıpuɐʇs ǝq ʇsnɯ noʎ uǝɥʇ˙˙˙sʎɐs sıɥʇ ʇɐɥʍ pɐǝɹ uɐɔ noʎ ɟI
Picmember.com - Full Quality Event-Based Photo Sharing
MitchDB: Gameserver Control System

Reply With Quote
  #5  
Old 10-01-2003, 02:18 PM
Jake Weg Jake Weg is offline
Disabled
 
Join Date: Feb 2003
Location: NY
Posts: 586
how does cpanel do it where it loads the script and provides hte output as the script does. or for that matter the tracert/ping scripts I see.

Reply With Quote
  #6  
Old 10-01-2003, 06:01 PM
CSD_Hosting CSD_Hosting is offline
Junior Guru
 
Join Date: Dec 2002
Location: UCIrvine, Irvine, CA
Posts: 193
proc_open() i believe, but im not sure, i know the code i pasted above will work on *nix machines, so u can use that.

__________________
(: ˙pɐǝɥ ɹnoʎ uo ƃuıpuɐʇs ǝq ʇsnɯ noʎ uǝɥʇ˙˙˙sʎɐs sıɥʇ ʇɐɥʍ pɐǝɹ uɐɔ noʎ ɟI
Picmember.com - Full Quality Event-Based Photo Sharing
MitchDB: Gameserver Control System

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Microsoft Revamps Cloud Storage Service with New Interface, API Updates Web Hosting News 2012-08-14 16:21:15
Web Hosts: Your Interface Is Your Product Blog 2012-06-13 12:15:37
Cloud Host VPS.NET Launches Beta of Desktop-like Control Panel Web Hosting News 2011-12-07 16:17:52
Web Host Liquid Web Launches New Account Management Interface Web Hosting News 2011-09-30 19:52:50
Web Host myhosting Offers Parallels Plesk Panel 10 VPS Plans Web Hosting News 2011-07-07 19:54:45


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

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

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?