EPICS Controls 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  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: drvAsynIPPort question
From: Sinisa Veseli <[email protected]>
To: Mark Rivers <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Wed, 20 Mar 2013 14:09:58 -0500
Ok, thanks, I'll give this a try.



On 03/20/2013 02:07 PM, Mark Rivers wrote:
No, that is not correct.  Here is the correct sequence/comments

1) drvAsynIPPortConfigure() with noAutoConnect=1;

Why are you using noAutoConnect=1?  If you have already created the server then you can use the default noAutoConnect=0.

2) pasynCommonSyncIO->connect(); get type 1 connection with common pasynUser

2a) pasynCommonSyncIO->connectDevice(); If you used noAutoConnect=1 you need this step, otherwise skip it

3) pasynOctetSyncIO->connect(); get type 1 connection with octet pasynUser

4) pasynOctetSyncIO->read()/write(); exchange data

5) pasynOctetSyncIO->disconnect(); release type 1 connection with octet pasynUser

6) pasynCommonSyncIO->disconnectDevice(); release type 2 connection with common pasynUser

7) pasynCommonSyncIO->disconnect(); release type 1 connection with common pasynUser

Note that the pasynXXXSyncIO->disconnect functions not only release the type 1 connection, they also call pasynManager->freeAsynUser.  This means that your pasynUser no longer points to a valid pasynUser structure, so it's a good idea to set the pointer to 0.

Mark

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Sinisa Veseli
Sent: Wednesday, March 20, 2013 1:31 PM
To: [email protected]
Subject: Re: drvAsynIPPort question

Mark,

Thanks for the response and clarifications. So, if I understood things,
the following is a proper process of establishing/using/destroying TCP
connection using asyn IP driver:

1) drvAsynIPPortConfigure() with noAutoConnect=1;

2) pasynCommonSyncIO->connect(); get type 2 connection with common pasynUser

3) pasynOctetSyncIO->connect(); get type 1 connection with octet pasynUser
4) pasynOctetSyncIO->read()/write(); exchange data
5) pasynOctetSyncIO->disconnect(); release type 1 connection with octet
pasynUser

6) pasynCommonSyncIO->disconnect(); release type 2 connection with
common pasynUser

Is the above correct?

It looks like drvAsynIPPortConfigure() does call
pasynManager()->connectDevice(), which would seem like I would end up
with 2 type 1 connections, which makes me a bit suspicious.

Thanks again,

Sinisa





On 03/20/2013 12:43 PM, Mark Rivers wrote:
I see that connection is closed in asynCommonDisconnect() method (file
interfaces/asynOctetSyncIO.c), but it isn't quite clear to me how this
method would get called (pasynOctetSyncIO->disconnect() does not seem to
do it).
The method you need to call is pasynCommonSyncIO->disconnectDevice(pasynUser)

Note that the pasynUser that you pass in this call must be created with pasynCommonSyncIO->connect(), and it must NOT be the pasynUser that you created with pasynOctetSyncIO->connect().  That is a common mistake.

Note that the asyn unfortunately has two meanings of the term "connect".

1) The first meaning is to connect a pasynUser to an asyn port driver and address.
2) The second to connect the asyn port driver to the underlying device, in your case a TCP socket.

pasynManager->connectDevice does the type 1 connection.
pasynCommon->connect does the type 2 connection.

To make things even more confusing the terms "connect" and "connectDevice" are reversed in the asynXXXSyncIO functions.

The asynXXXSyncIO functions pasynXXXSyncIO->connect do a type 1 connection.  This really should have been called "connectDevice" to make it consistent with the pasynManager function.

pasynCommonSyncIO->connect does a type 1 connection, to be consistent with all of the other asynXXXSyncIO methods.  pasynCommonSyncIO->connectDevice does a type 2 connection, while this should have been called "connect" to be consistent with the pasynCommon method.

Unfortunately we need to live with these names, it's too late to change them now.

Mark

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Sinisa Veseli
Sent: Wednesday, March 20, 2013 12:02 PM
To: [email protected]
Subject: drvAsynIPPort question

Hi,

Does anyone know what is the proper way to destroy tcp socket created
via drvAsynIPPortConfigure?

My test client and server use drvAsynIPPortConfigure and
drvAsynIPServerPortConfigure from asyn 4-18, and I can connect and
exchange data between the two. However, no matter what I try, I am not
able to destroy the client socket properly.

I see that connection is closed in asynCommonDisconnect() method (file
interfaces/asynOctetSyncIO.c), but it isn't quite clear to me how this
method would get called (pasynOctetSyncIO->disconnect() does not seem to
do it).


I looked through marCCD.cpp in area detector module (Tim Madden kindly
pointed that out as an example),  but I only saw
pasynOctetSyncIO->connect() being called.


In any case, I would appreciate any pointers, and sorry if I'm missing
something obvious...

Thanks,

Sinisa





--
Sinisa Veseli
Software Services Group
APS Engineering Support Division
Argonne National Laboratory
[email protected]
(630)252-9182


References:
drvAsynIPPort question Sinisa Veseli
RE: drvAsynIPPort question Mark Rivers
Re: drvAsynIPPort question Sinisa Veseli
RE: drvAsynIPPort question Mark Rivers

Navigate by Date:
Prev: RE: drvAsynIPPort question Mark Rivers
Next: RE: drvAsynIPPort question Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: drvAsynIPPort question Mark Rivers
Next: Re: drvAsynIPPort question J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·