[PLUG] sending data from single serial port to multiple readers

Galen Seitz galens at seitzassoc.com
Mon Sep 9 23:03:58 UTC 2013


On 09/09/13 15:35, Bill Barry wrote:
> On Mon, Sep 9, 2013 at 3:21 PM, Galen Seitz <galens at seitzassoc.com> wrote:
>> Hi,
>>
>> I have a need to allow multiple network connections to a single serial
>> port.  Data from the serial port needs to be sent to *all* network
>> clients, and each network client needs to write to the serial port.  Is
>> there a way to achieve this using command line tools, or do you think I
>> will end up having to write my own code?
>>
>> Both conserver and gpsd have functionality similar to what I'm looking
>> for, but they are both overkill for my needs.  I'm hoping I can find
>> something that will require less hacking.
>>
>> Ultimately this needs to run on an embedded system running OpenWrt, so
>> I'm uncertain as to whether a high level scripting(Perl/Python) solution
>> is viable.
>>
>> Thanks for any suggestions you can provide.
>>
>> galen
>> --
>
> netcat would be useful for that. Busybox comes with an implementation
> of netcat so I think it could work on openwrt.

I should have mentioned that I already tried socat(netcat on steroids). 
  Here's the command I started with:

socat tcp-l:9001,reuseaddr,fork /dev/ttyUSB0,raw,echo=0,crnl

This is close to what I want, but the data from the serial port is not 
sent to all readers.  I'm not sure, but I think there is a single file 
descriptor associated with the serial data, so it's a first reader wins 
situation, where the first reader is unpredictable.  I sent a message to 
the socat developer asking for hints on how to accomplish my particular 
multiple reader situation, but I have yet to hear back.

galen
-- 
Galen Seitz
galens at seitzassoc.com




More information about the PLUG mailing list