Last active
November 13, 2015 22:10
-
-
Save jbasinger/f31d06f34b2977ddc8c6 to your computer and use it in GitHub Desktop.
Platform Specifics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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! | |
| } | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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