Unix Programming - Re: Linux: two processes read/write on single serial port

This is Interesting: Free IT Magazines  
Home > Archive > Unix Programming > May 2007 > Re: Linux: two processes read/write on single serial port





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Linux: two processes read/write on single serial port
Jens Thoms Toerring

2007-05-17, 7:16 am

Steven Woody <narkewoody@gmail.com> wrote:
> On May 17, 1:32 am, j...@toerring.de (Jens Thoms Toerring) wrote:
[vbcol=seagreen]
> actually, each process need both read and write. what process A read
> comes from what process B write, and what process A write becomes what
> process B read.


That's going to be "interesting", not because of a problem with
both processes opening the serial port in read/write mode, but
because you have to figure out a way to keep the processes from
reading what they just have written. If you for example would
have A write something to the port for B to receive and then
immediately would have A start to read, expecting an answer from
B, then that could easily fail with A reading what it just had
send because B hadn't had a chance to read it yet. You will need
some additional communication channel that A and B use to syn-
chronize their read accesses. For example A could send a signal
to B when it has finished reading a complete message from B with
B waiting for that signal before starting to try to read again,
and the same the other way round.

Regards, Jens
--
\ Jens Thoms Toerring ___ jt@toerring.de
\__________________________ http://toerring.de
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com