[ts-gen] Hooking into shim directly via C/C++

Nils Gebhardt mail at ngebhardt.de
Wed Aug 26 14:45:30 EDT 2009




On Wed, 2009-08-26 at 17:28 +0900, Ken Feng wrote:


> So I tried rewriting what little Ruby code there was in C/C++,
> thinking it would be a little work, but really shouldn't be that
> bad...  ...until I looked up popen() to replace Ruby's IO.popen().  It
> appears that the call is at such a low level that only one direction
> (read or write) can be opened at a time.  To do bi-directional piping,
> I have to fork() and do all sorts of not-so-fun-stuff.

I am not really familiar with ruby, so I came also to the C popen call,
stumbling on  the same point with reads/writes. Now I have a single
small C program doing nothing else than reading from a named pipe,
writing to a shim process which is open (and kept constantly  open) in a
popen call, which in turn  writes to a log in the file system. That
allows me to read and write from others programs asynchronously to/from
shim while still recieving asynchronously messages from tws like order
status messages, what I find sufficient. 

regards 

Nils



More information about the ts-general mailing list