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  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: Using asyn as a TCP socket client in AD ioc
From: "Marco A. Barra Montevechi Filho via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Wed, 22 Feb 2023 23:50:52 +0000
Hello all,

Context:
I have an AreaDetector ioc which i want to communicate with a simple TCP socket. Since its heavily based on ADSim, i figured i would want to test the basic functionalities in ADSimDetector before trying the implementation in the actual ioc. I have my ADSimdetector from areaDetector-R3-11.

Since ADDriver inherits from asynNDArrayDriver which inherits from asynPortDriver, i figured i could use asynPortDriver's inherited methods to instantiate the socket client and asyn interface instead of creating everything again from scratch in c++.
So im inside areaDetector-R3-11/ADSimDetector/simDetectorApp/src/simDetector.cpp:1021 - that is, inside the simDetector class constructor - trying in all sorts of ways to create an asyn client to a socket... and failing.

What i managed to do so far: create an asynPort with drvAsynIPPortConfigure("PORT", "127.0.1.1:<test_port>") in the st.cmd file and, inside the cpp file:

#include <asynOctetSyncIO>
//(...) next line is inside the constructor
pasynOctetSyncIO->connect("PORT", 0, &pasynUserSelf, NULL);

but:

1 - im not even sure this is was i want to do: i think i would prefer to create the port and TCP connection already inside the cpp code instead of depending on cmd file;
2 - i dont know how to use the write method. I tried pasynOctetSyncIO->write(NULL, pasynUserSelf, "TEST\n", strlen("TEST\n"), sizeof("TEST\n")); and similar lines but i get:
../simDetector.cpp:1025:35: error: cannot convert ‘asynUser*’ to ‘const char*’ in argument passing
 1025 |     pasynOctetSyncIO->write(NULL, pasynUserSelf, "TEST\n", strlen("TEST\n"), sizeof("TEST\n"));


In the doxygen pages (https://epics-modules.github.io/master/asyn/R4-30/asynDoxygenHTML/classasyn_octet_client.html), i could only find asynOctetClient->write instead of asynOctetSyncIO->write and they do seem different. In this documentation (https://epics-modules.github.io/master/asyn/R4-43/asynDriver.html#asynOctet) it isnt clear to me what is the expected *drvPvt...

Questions (finally):

1 - Can i instantiate my asynPort inside the cpp code to avoid using drvAsynIPPortConfigure?
2 - How can i write/read to the connected port?
3 - Is there a minimal working example which i can follow?

Im sorry if the doubts are trivial but i really have been lost in the documentation for some time now. Thanks in advance,

Marco

Aviso Legal: Esta mensagem e seus anexos podem conter informações confidenciais e/ou de uso restrito. Observe atentamente seu conteúdo e considere eventual consulta ao remetente antes de copiá-la, divulgá-la ou distribuí-la. Se você recebeu esta mensagem por engano, por favor avise o remetente e apague-a imediatamente.

Disclaimer: This email and its attachments may contain confidential and/or privileged information. Observe its content carefully and consider possible querying to the sender before copying, disclosing or distributing it. If you have received this email by mistake, please notify the sender and delete it immediately.


Replies:
RE: Using asyn as a TCP socket client in AD ioc Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: S7nodave for EPICS Manual Mark Rivers via Tech-talk
Next: RE: Using asyn as a TCP socket client in AD ioc Mark Rivers via Tech-talk
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  <20232024 
Navigate by Thread:
Prev: Re: S7nodave for EPICS Manual Mark Rivers via Tech-talk
Next: RE: Using asyn as a TCP socket client in AD ioc Mark Rivers via Tech-talk
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  <20232024 
ANJ, 22 Feb 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·