Hello Mark,
Can this be used to find out if the device connected on RS232 based serial port is powered down, or the communication is not responding.
Ie will Modbus like module do an auto reconnect on serial communication timeout. This problem may not occur on actual serial com ports.
However, for virtual comports, I have noticed at times the driver drops the backend TCP connection and to restore the connection I have to close the comport and then reconnect.
Here similar reconnect functionality for Modbus over TCP will be useful for serial port (in view of the virtual com port based devices)
Regards,
Kuldeep
Date: Fri, 9 Dec 2022 02:51:07 +0000
From: Mark Rivers <rivers at cars.uchicago.edu>
To: EPICS tech-talk <tech-talk at aps.anl.gov>, "Wang, Andrew"
<wang126 at llnl.gov>
Subject: Re: Ways to know if instrument connected via TCP/IP through
StreamDevice has lost connection
Message-ID:
<DM5PR11MB20127608AD0E433E01A94181991C9 at DM5PR11MB2012.namprd11.prod.outlook.com>
Content-Type: text/plain; charset="iso-8859-1"
Hi Andy,
> I feel like there is a better way than me trying to use a calcout record and check if any record has its STAT field set to COMM. Like, is it possible to monitor for connection status without needing to process a record whose device type is StreamDevice and check its STAT field?
Yes, there is a better way.
First, you probably want to use this line in your startup script:
asynSetOption("$(PORT)",0, "disconnectOnReadTimeout", "Y")
That will cause the port to disconnect if there is a timeout. If you don't do that then the asyn won't know that the port is disconnected for a very long time on Linux, it will just keep giving "temporarily unavailable" messages.
In your startup script load an asyn record that is connected to that asyn port. Here is an example:
dbLoadRecords("$(ASYN)/db/asynRecord.db", "P=IOC:, R=asyn1, PORT=ARIES1, ADDR=0, OMAX=256, IMAX=256")
You can monitor the IOC:asyn1.CNCT field, which will either be "Connect" or "Disconnect".
Mark
________________________________
From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Wang, Andrew via Tech-talk <tech-talk at aps.anl.gov>
Sent: Thursday, December 8, 2022 8:21 PM
To: EPICS tech-talk <tech-talk at aps.anl.gov>
Subject: Ways to know if instrument connected via TCP/IP through StreamDevice has lost connection
Hi all,
Basically, I was wondering if there is a better way to know if communication to an instrument has been lost. I understand that this can be done either by simplying looking at the IOC shell for disconnection errors or checking if the STAT field is set to COMM.
I was wondering if there is another method of determining if the instrument is still connected or not besides the two methods described above. Additionally, I would like to have a record called "is_instrument_connected", that holds a value like 1 to indicate the instrument is connected and a 0 if it is not. I feel like there is a better way than me trying to use a calcout record and check if any record has its STAT field set to COMM. Like, is it possible to monitor for connection status without needing to process a record whose device type is StreamDevice and check its STAT field?
Thank you,
Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.aps.anl.gov/pipermail/tech-talk/attachments/20221209/0ce7a120/attachment.html>
------------------------------
Subject: Digest Footer
_______________________________________________
Tech-talk mailing list Tech-talk at aps.anl.gov
https://mailman.aps.anl.gov/mailman/listinfo/tech-talk
------------------------------
End of Tech-talk Digest, Vol 16, Issue 707
******************************************