Hi Terry,
I just looked at the code for drvAsynIPPort. It only calls bind() if you specify the localPort in your hostInfo string. So I think this should be
drvAsynIPPortConfigure("CRYOREAD01","255.255.255.255:30304:30304 UDP*",0,0,0)
I think you maybe should use UPD and not UDP*. UDP* is meant for sending broadcasts, not receiving them.
I am not sure anyone has used drvAsynIPPort for receiving broadcasts, only for sending them. Please give the above a try and if it does not work I will fix the driver.
Mark
________________________________
From: [email protected] <[email protected]> on behalf of CORNALL, Terry via Tech-talk <[email protected]>
Sent: Sunday, March 17, 2019 11:31 PM
To: [email protected]
Cc: SAMARDZIC-BOBAN, Vesna; Andrew Price; CLIFT, Mark
Subject: drvAsynIPPort Not receiving broadcast UDP [SEC=UNCLASSIFIED]
Hi All.
I have a device that sends its status as a UDP broadcast with port 30304 and I’d like to use asynIP to get it but can’t get it working using simple interactive commands in EPICS iocsh.
I have successfully tested the server and host in question using a little python socket program, essentially:
########### start PYTHON CODE###############
broadcastIP = '255.255.255.255' #note that 10.6.255.255 doesn’t work, though I expected it to…
idBroadcast = (broadcastIP,30304)
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
s.bind(idBroadcast)
m, reportedAddress = s.recvfrom(bufMax) #m gets the data and reportedAddress indicates where it was broadcast from
################END PYTHON CODE######################
and it works, gets the status every second. So no firewalls getting in the way and the port number is OK and status is being broadcast every second as expected.
Trying to use asynIP in EPICS, I do the following to test, using asynDriver release 4.34:
#########start EPICS IOCSH commands############
drvAsynIPPortConfigure("CRYOREAD01","255.255.255.255:30304 UDP*",0,0,0) #Have also tried the specific subnet broadcast 10.6.0.255 and 10.6.255.255 with no luck
…… #no errors reported
iocInit()
asynSetTraceMask ("CRYOREAD01",-1,0xFF)
asynSetTraceIOMask("CRYOREAD01",-1,0xFF)
…..#no errors reported
epics>
#Then ran the following interactively
epics> asynOctetConnect CR CRYOREAD01 0 10 200 #address 0, timeout of 10 sec, buffer 200
epics> asynOctetRead CR 100
From asynTrace I get:
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort locking port
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort created queueLockPortPvt=0x183c0f0
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort created queueLockPortPvt=0x183c0f0, event=0x183c110, mutex=0x18318c0
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort taking mutex 0x18318c0
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort queueing request
2019/03/18 15:10:17.359 CRYOREAD01 addr -1 queueRequest priority 0 not lockHolder
2019/03/18 15:10:17.359 CRYOREAD01 schedule queueRequest timeout
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort waiting for event
2019/03/18 15:10:17.359 asynManager::portThread port=CRYOREAD01 callback
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPortCallback signaling begin event
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPortCallback waiting for mutex from queueUnlockPort
2019/03/18 15:10:17.359 CRYOREAD01 asynManager::queueLockPort got event from callback
2019/03/18 15:10:17.359 255.255.255.255:30304 UDP* read.
…..waits 10 sec
2019/03/18 15:10:27.369 CRYOREAD01 read from low-level driver returned 1
2019/03/18 15:10:27.369 CRYOREAD01 queueUnlockPort
2019/03/18 15:10:27.369 CRYOREAD01 asynManager::queueUnlockPort waiting for event
2019/03/18 15:10:27.369 CRYOREAD01 queueUnlockPort unlock mutex 0x18318c0 complete.
2019/03/18 15:10:27.369 Error reading, ninp=0 error 255.255.255.255:30304 UDP* timeout: Resource temporarily unavailable
and it always timesout with nothing received.
I also tried asynReport 4 CRYOREAD01 and got the following. Somewhat suspicious of nDevices=0 but this might be ok for a nonMultiDevice?
CRYOREAD01 multiDevice:No canBlock:Yes autoConnect:Yes
enabled:Yes connected:Yes numberConnects 1
nDevices 0 nQueued 0 blocked:No
asynManagerLock:No synchronousLock:No
exceptionActive:No exceptionUsers 1 exceptionNotifys 0
traceMask:0xff traceIOMask:0xff traceInfoMask:0x1
interposeInterfaceList
asynOctet pinterface 0x7f986797d6e0 drvPvt 0x16d1410
interfaceList
asynCommon pinterface 0x7f986797a750 drvPvt 0x16cd7c0
asynOption pinterface 0x7f986797a770 drvPvt 0x16cd7c0
asynOctet pinterface 0x16cd8e0 drvPvt 0x16cd7c0
Port 255.255.255.255:30304 UDP*: Connected
fd: 4
Characters written: 0
Characters read: 0
Can anyone suggest why this isn’t working or what I should do to better test it? (I did see comment in techtalk about UDP broadcast issues, but I think they were for versions older than the one I am using)
Thanks,
Terry
- Replies:
- RE: drvAsynIPPort Not receiving broadcast UDP [SEC=UNCLASSIFIED] Mark Rivers via Tech-talk
- References:
- drvAsynIPPort Not receiving broadcast UDP [SEC=UNCLASSIFIED] CORNALL, Terry via Tech-talk
- Navigate by Date:
- Prev:
Re: StreamDevice processing issue Lucock, Richard M via Tech-talk
- Next:
RE: drvAsynIPPort Not receiving broadcast UDP [SEC=UNCLASSIFIED] 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
2023
2024
- Navigate by Thread:
- Prev:
drvAsynIPPort Not receiving broadcast UDP [SEC=UNCLASSIFIED] CORNALL, Terry via Tech-talk
- Next:
RE: drvAsynIPPort Not receiving broadcast UDP [SEC=UNCLASSIFIED] 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
2023
2024
|