Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Re: asynManager isConnected
From: "J. Lewis Muir" <jlmuir@imca-cat.org>
To: matthew.pearson@diamond.ac.uk
Cc: tech-talk@aps.anl.gov
Date: Fri, 01 Jun 2012 10:18:38 -0500
On 6/1/12 6:17 AM, matthew.pearson@diamond.ac.uk wrote:
> Hi,
> 
> I'm trying to use asynManager isConnected() to test whether or not an IP port is connected to a device. But I'm finding that isConnected() only seems to report the connected status of the asynUser structure to the underlying device.
> 
> If I attempt to call drvAsynIPPort on an IP address that has nothing connected to it, the connection fails. Then I attempt to connect an asynUser to this port using asynOctetSyncIO connect(), which also fails. Then I call asynManager isConnected a few times, and I find that the first few calls return false, and then after iocInit it returns true. But still, in the background, asynManager is attempting to connect to the IP port via the autoConnect feature.
> 
> Is this behaviour correct? 
> 
> I can get around it by maintaining connected status myself. But the documentation seems to indicate that isConnected() shouldn't return true if the IP port is not connected.

Hi, Matt.

I'm sure Mark Rivers or someone else will give a more helpful
response, but I'll just share what I usually do.

If I want to write an IP client that handles connecting and
disconnecting of an IP socket, I do the following:

1. Ensure that auto-connect is disabled for the ASYN IP port

2. Create and attach an asynUser to the ASYN port using
   pasynOctetSyncIO->connect

3. Create and attach an asynUser for the pasynCommonSyncIO
   interface using pasynCommonSyncIO->connect

4. Establish the IP socket connection (using the
   pasynCommonSyncIO asynUser) using
   pasynCommonSyncIO->connectDevice

5. I can now use the pasynOctetSyncIO asynUser for reading and
   writing on the IP socket.

If I don't want to handle connecting and disconnecting of an IP
socket myself, I enable auto-connect for the ASYN port and don't
make any attempt at connecting or disconnecting the IP socket
since that would interfere with the auto-connect functionality.

I don't know of a function in Asyn that allows one to determine
whether the IP socket is connected.  I always just determine
this based on the asynStatus returned from a read or write.  But
maybe there's a way that I don't know about?

Lewis

Replies:
RE: asynManager isConnected matthew.pearson
RE: asynManager isConnected Mark Rivers
References:
asynManager isConnected matthew.pearson

Navigate by Date:
Prev: RE: asynManager isConnected Mark Rivers
Next: Re: mbbi/mbbo Mask values Andrew Johnson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: RE: asynManager isConnected Mark Rivers
Next: RE: asynManager isConnected matthew.pearson
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·