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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: Proposed change to asyn drvAsynIPPort for UDP sockets |
From: | Henrique Almeida <[email protected]> |
To: | Mark Rivers <[email protected]> |
Cc: | EPICS Core-Talk <[email protected]>, EPICS Tech Talk <[email protected]> |
Date: | Wed, 9 Dec 2015 10:35:15 -0200 |
Folks,
I have found a problem with the handling of UDP sockets in drvAsynIPPort. The problem arises when a broadcast socket is created using the IP protocol string “UDP*” in the call to drvAsynIPPortConfigure(). Calls to asynOctet->write() are OK, broadcast messages get sent correctly. However, if a client attempts to reply to such a broadcast (using the ephemeral source port number that was sent in the broadcast message) then that reply is rejected by the host that sent the broadcast.
The problem is that the current version of drvAsynIPPort always calls connect() on all sockets, including UDP sockets. It then calls send() and recv() to write and read from the socket respectively. This does not work correctly in the case of UDP broadcast sockets.
I have created a new issue for the problem on github:
https://github.com/epics-modules/asyn/issues/11
The problem is fixed by doing the following for broadcast UDP sockets:
- Don't call connect()
- Call sendto() rather than send()
- Call recvfrom() rather than recv()
Eric Norum and I cannot think of a reason not to make the above changes for all UDP sockets, not just broadcast sockets. I have made a new udp_fixes branch on github that implements the above changes for all drvAsynIPPort UDP ports.
https://github.com/epics-modules/asyn/tree/udp_fixes
I have tagged the current version of that branch as the R4-28beta1 release.
I would like to encourage comments and testing of these changes before I release asyn R4-28. If you currently use UDP sockets with asyn please try to test by either checking out the udp_fixes branch or downloading the tar or zip file for R4-28beta1 release.
Thanks,
Mark