[Mono-list] Questions on Mono.Unix.Pipes
billsix at gmail.com
Mon Dec 17 21:10:21 UTC 2012
Since you are relatively new to Linux, write two simple programs in C which
use pipes to communicate (the first program is the producer, the second is
the consumer). You'll need fork, exec, and probably dup2.
Once done, porting the consumer to Mono is straightforward. (Assuming you
know C and C# well enough).
In a day or 2, when I have access to a computer instead of just a tablet, I
will send a solution to you.
On Dec 17, 2012 12:05 PM, "mickeyf" <mickey at thesweetoasis.com> wrote:
> I have some questions about Mono.Unix.Pipes.
> I have been using this with some success, but I am relatively new to
> and the mono documentation that I have found is missing or incomplete. The
> Linux manual pages docs on pipes are clearly referring to a different
> than this.
> Specifically, I have been creating a pipe in a Mono app, passing the
> of the write end to a shared library. The shared library writes data to
> pipe, which is read by the read end of the pipe on the mono app. This
> although the case in which all the data is not gotten in a single read
> operation gets messy.
> It appears that I can read a pipe as
> read_position, bytes_to_read).
> I understand that I can't actually fseek using read_position, but it seems
> that if I do not read the entire bytes_to_read, I can then continue to
> adjust read_position to read the remaining data.
> 1) Is this correct usage, or am I missing something here?
> 2) Since I can't find documentation specific to this, it's not clear what
> the return values from Read will be when I can't actually read anything.
> Does -1 indicate error, or simply "no data available"? What about 0?
> 3) Can I set the write end to disable O_NONBLOCK, and does this guarantee
> that both the write and the read are atomic and that all bytes will in
> be read in a single read on the read end of the pipe? (Assuming no SIG???)
> If so, how do I do this?
> If there is actual detailed documentation on Mono.Unix.Pipes, directing me
> to that would be great.
> Or, since what I really want to do is guarantee that a entire (privately
> defined) data packet as written by my C library code is read by my mono
> perhaps there is an entirely different, and better way to do this?
> View this message in context:
> Sent from the Mono - General mailing list archive at Nabble.com.
> Mono-list maillist - Mono-list at lists.ximian.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-list