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