Thank you Francois,
I was considering trying the array but wasn't sure that it would improve my
results - having a single event handler is an excellent idea.
By 'bogged down' I mean that I can send and receive, alternating instruments
but eventually the instruments (or the software) stop working correctly - my
guess is that using only one OndataReceive event will so a long way to
resolving this
Do you have a postcard from Orillia, Ontario, Canada yet?
Regards
Lusty
-----Original Message-----
From: François Piette
Sent: Tuesday, February 25, 2014 1:07 PM
To: 'ICS support mailing'
Subject: Re: [twsocket] Multiple TCp clients
Hello Chris,
Don't use TWSocketServer.
You should create an array (or a list or any collection you like) or
TWSocket components. Then connect each TWSocket to his own instrument. You
may use the same event handlers for all the TWSocket, simply use the Sender
argument in each event to now who is who. All the sockets will work in
parallel without any problem, without using thread and without requiring any
synchronization with GUI components.
If I leave both instruments connected the system runs for a bit but
eventually gets bogged down.
Not sure by what you mean by "bogged down". Ru your app under the debugger
and report any exception. Also use madExcept to catch many errors with
memory allocation and things like using freed objects and so on.
--
francois.pie...@overbyte.be
Embarcadero MVP
http://www.overbyte.be
http://francois-piette.blogspot.com
-----Message d'origine-----
De : TWSocket [mailto:twsocket-boun...@lists.elists.org] De la part de
Christopher Lusty
Envoyé : lundi 24 février 2014 22:38
À : twsocket@lists.elists.org
Objet : [twsocket] Multiple TCp clients
Hello all,
I am trying to interface with some laboratory instruments, previously we
used RS-232, now we are working on the next generation of machines
The instruments act as servers, I have established reliable communications
with each of the instruments as individual units using WSocket as a client.
Now, I would like to set it up such that I can talk to each instrument in
turn (it is never necessary to talk to more than one machine at a time).
As an experiment I have built a small app with two TWServers on board, each
is connected to buttons to dis/connect, send the contents of an edit box and
place the results in a memo. Each client represents a different instrument.
The setup works reasonably well if I connect-send-disconnect each instrument
in turn. If I leave both instruments connected the system runs for a bit but
eventually gets bogged down. I have no problem with having to make and break
when I switch machines except for the fact that sometimes the reconnect can
take a few seconds which, of course, slows things.
Any suggestions for this TCP newbie as to how to use multiple clients within
one piece of software would be greatly appreciated. I’d like to avoid
threading.
BTW – compiler is Delphi 7 (soon to be ported to XE2)
Best regards
Chris Lusty
(first time poster)
C.W. Lusty, PEng MBA
Hinterland Software Ltd.
Software manufacturers for the PC-Titrate family of products www.titrate.com
--
To unsubscribe or change your settings for TWSocket mailing list please goto
http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be