http://qs1969.pair.com?node_id=293787


in reply to Design Advice: Reading data from a serial port and writing it to multiple sockets.

Had I been tasked to do this (I'm keen to know what the application) I would consider Thread::Queue. I realise you mention writing a forker, it did not seem clear if that was a requirement or part of 'just-one-of' many possible designs.

A 'serial' thread listens to the tty, dropping incoming data onto a queue. Checks a different queue for information from your socket process (TBD not in your requirements yet). A socket thread controls the multiple socket connections and relays any information arriving in the from-serial-thread queue.

As always YMMV :)


I can't believe it's not psellchecked