freeprocess lag

BlitzMax Forums/BlitzMax Programming/freeprocess lag

plash(Posted 2008) [#1]
I'm writing alot of data to a pipestream to another process, reading it by using stdio (using a new TCStandardIO object).

Should I be flushing the pipestream after writing data?

Since there is no readavail for TCStandardIO how can I be sure the data is already buffered before reading?

I keep getting a TStreamReadException if I don't put a huge delay before trying to read data from TCStandardIO.

I created a new TCStandardIO object because the existing StandardIOStream didn't work on small data tests using read/write int and string. The data is being encrypted so I couldn't use read/write line, because the encryption could generate a return char.


skidracer(Posted 2008) [#2]
you should flush your writes at the end of every packet similar to the print function declared in brl.standardio.standardio.bmx.

in windows you can hook up stdio with freeprocess like so
Strict

Local io:TPipeStream

Local stdin=GetStdHandle(-10)
Local stdout=GetStdHandle(-11)


io=TPipeStream.Create( stdin,stdout )

io.Write("hello".toCString(),5)
io.Flush

io.Close

End


just crashed maxide monitoring stdin so possibly kind of dangerous way of operating.

under osx/linux i think you can use stdin_ stdout_ global handles instead


plash(Posted 2008) [#3]
Hmm.. thats interesting.

Where is GetStdHandle defined?


skidracer(Posted 2008) [#4]
Somewhere in pub.win32 i think, i found it on msdn and it just worked...