Results 1 to 6 of 6

Thread: pipelines ... program1.exe | program2.exe SOLVED

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member BramVandenbon's Avatar
    Join Date
    Jan 2002
    Location
    Belgium
    Posts
    502

    pipelines ... program1.exe | program2.exe SOLVED

    - INTRODUCTION -
    I'm working on a GoBot project.

    Go is a worldfamous (asian) boardgame.
    A lot of computerprograms are written for letting people play with GoBots.

    And there are also a lot of Go Servers where people can play eachother.

    Letting bots play on these servers has been impossible for a long time. But recently there is a new protocol "GTP".

    each goserver makes his own bridge between the bot and its server.

    - WHAT I DID -
    I need 2 programs to communicate using standard input and standard output.

    MS-DOS and linux users will propably know how this is done:

    if you launche program1 like this ...
    program1.exe | program2.exe

    Then program 1 sends its output to the input of program2 and the other way round.

    Program 1 is written in Java by the owners of the server. My program is written in C#but that doesn't really matter.

    in my program I use Console.WriteLine() to send my commands. And indeed the other program receives all my commands.

    - THE PROBLEM -

    If I want to receive Input from the other program ...

    I can't make a Console.readline() loop cause i never know in advance when the other program is going to send something. Using readline would make my program hang till i receive something and then make it hang again.

    And even when i put my loop right behind my Writeline I don't receive the input because mostly my Readline is too late.

    So I need some kind of event that gets triggered when i receive input. But the Console class doesn't contain this kind of thing.

    I tried the In property of the Console class to put the input into a StreamReader object. But the same problem occures. When I'm using sr.Readline() the whole program hangs. and still the timing is impossible

    - ... -
    Does anybody have any experience with this kind of problems ?
    I went through MSDN and didn't find any kind of information about it.

    Thank you in advance
    Last edited by BramVandenbon; Apr 6th, 2004 at 02:41 PM.

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