in reply to TCP Socket and Serial Port
Your code is fundamentally flawed.
It is flawed in many ways -- for example: what do you think you are achieving by having 1 && in your while loops?:
.while( 1 && $serialport ne "" && $errorwithserial == 0 ) { ... while( 1 && $errorwithserial == 0 ) {
-- but the fundamental error is the concept of having multiple, concurrent clients holding two-way conversations with a single serial port. That simply cannot work.
It is possible to envisage having a thread that polls all possible information from the serial port connected device and caching that information in shared memory. And then having multiple, concurrent clients connect and query (subsets of) that information from the shared cache.
Whether that makes sense really depends upon:
ie. number of possible commands or distinct queries?
Does the queried information change hourly? Or every microsecond?
ie. the number and frequency of the client connects and the number of commands per connection.
A little more information regarding the overall aims of the program -- eg. what is an "AVR"? I looked it up and two possibilities stood out: 1) Audio/video receiver; 2) AVR reactor, a German prototype pebble bed reactor.
With the former, I cannot see the point of multiple clients connection to my HiFi.
With the latter, I terrifies me that any one would allow multiple connections to a "reactor". Even if it is not of the nuclear variety.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: TCP Socket and Serial Port
by wiredrat (Acolyte) on Jan 10, 2012 at 16:35 UTC | |
by BrowserUk (Patriarch) on Jan 10, 2012 at 17:16 UTC | |
|
Re^2: TCP Socket and Serial Port
by FlyingEagle (Initiate) on Jan 10, 2012 at 19:50 UTC | |
by BrowserUk (Patriarch) on Jan 10, 2012 at 21:26 UTC | |
by FlyingEagle (Initiate) on Jan 11, 2012 at 23:31 UTC | |
by BrowserUk (Patriarch) on Jan 12, 2012 at 02:17 UTC | |
by FlyingEagle (Initiate) on Jan 10, 2012 at 23:19 UTC |