Skip to content

Instantly share code, notes, and snippets.

@jbasinger
Last active November 13, 2015 22:10
Show Gist options
  • Select an option

  • Save jbasinger/f31d06f34b2977ddc8c6 to your computer and use it in GitHub Desktop.

Select an option

Save jbasinger/f31d06f34b2977ddc8c6 to your computer and use it in GitHub Desktop.
Platform Specifics
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading; //Had to add this.
using System.Threading.Tasks;
namespace ConsoleApplication1 {
class Program {
static void Main(string[] args) {
Console.WriteLine("Started!");
while (true) {
String newData = Console.In.ReadLine();
if (newData.ToLower() == "ping") {
Console.WriteLine("pong");
}
Thread.Sleep(1); // Need to give other things a chance to go!
}
}
}
}
var child_process = require('child_process');
//This is the path to the executable you want to talk to
var path = '../ConsoleClient/ConsoleApplication1/ConsoleApplication1/bin/Debug/ConsoleApplication1.exe';
var client = child_process.spawn(path,[]);
client.stderr.on('data', function(err){
console.log(err.toString('utf8'));
});
client.stdout.on('data', function(data){
console.log(data.toString('utf8'));
});
client.on('error', function(err){
console.log(err);
});
client.stdin.write('ping\n');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment