Experimental Physics and Industrial Control System
On Oct 9, 2014, at 11:11 AM, Mark Rivers <[email protected]> wrote:
> Hi Lewis,
>
>> I wouldn't think just reading would work. If it's just blocking
>> indefinitely in a read, and the hardware it's communicating with is then
>> powered off, for example, I don't think the blocking read will detect
>> that.
>
> I'm not sure I understand this. asyn does reads either using poll with a timeout or setting a socket timeout. If the device is powered off then the recv() will initially timeout return an error like "Device is temporarily unavailable", but if the read is done repeatedly then after some system-dependent period of time the OS will disconnect the socket, and asyn will mark the port as disconnected.
>
> The problem as I understand it is that some ports on his PLC are "write only", so he is not allowed to do a read. We wants to do a write that has no side-effects except seeing if the device is connected.
>
> The best way to do this probably to assume that if one of the read ports is disconnected, then the device is not available, and not try to do it for the write-only ports at all.
>
> Of course, Jignesh you could try modifying drvAsynIPPort.c to allow a 0-length read and see what you observe.
I think you meant 0-length write. A 0-length read from a stream socket marks an end-of-file (socket shutdown). This is why a 0-length write has no effect at the reader. Whether or not a 0-length write actually generates any network activity and/or tests the connection status seems a bit of a mystery — or at least I infer that from the discussions here.
--
Eric Norum
[email protected]
- Replies:
- RE: TCP connection status : drvAsynIPPort Mark Rivers
- References:
- TCP connection status : drvAsynIPPort Patel Jignesh
- RE: TCP connection status : drvAsynIPPort Mark Rivers
- RE: TCP connection status : drvAsynIPPort Patel Jignesh
- RE: TCP connection status : drvAsynIPPort Mark Rivers
- Re: TCP connection status : drvAsynIPPort Torsten Bögershausen
- Re: TCP connection status : drvAsynIPPort J. Lewis Muir
- RE: TCP connection status : drvAsynIPPort Mark Rivers
- Navigate by Date:
- Prev:
RE: TCP connection status : drvAsynIPPort Mark Rivers
- Next:
RE: TCP connection status : drvAsynIPPort Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
RE: TCP connection status : drvAsynIPPort Mark Rivers
- Next:
RE: TCP connection status : drvAsynIPPort Mark Rivers
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024