in reply to Re^4: TCP Socket and Serial Port
in thread TCP Socket and Serial Port

In a nutshell, use a single thread for communicating with your serial port. Set up two Thread::Queues: one for inbound commands; one for outbound responses.

When one of your clients sends a command, post it to the inbound queue.

Have your another thread monitor the outbound queue and forward a copy of each thing it dequeues to every connected client.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?