EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: Proposed change to asyn drvAsynIPPort for UDP sockets
From: Mark Rivers <[email protected]>
To: "'EPICS Tech Talk'" <[email protected]>, "'EPICS Core-Talk'" <[email protected]>
Date: Wed, 9 Dec 2015 00:38:10 +0000

Eric Norum suggested some changes in the implementation.  drvAsynIPPort now always calls recvfrom() rather than recv(), even for TCP sockets.  The source IP address is now printed in the ASYN_TRACEIO_DRIVER debug output, which can be helpful in seeing what host a UDP message came from.

 

I have tagged the new version R4-28beta2.

 

Mark

 

 

From: Mark Rivers
Sent: Tuesday, December 08, 2015 12:36 PM
To: EPICS Tech Talk; EPICS Core-Talk
Subject: Proposed change to asyn drvAsynIPPort for UDP sockets

 

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

 


References:
Proposed change to asyn drvAsynIPPort for UDP sockets Mark Rivers

Navigate by Date:
Prev: Proposed change to asyn drvAsynIPPort for UDP sockets Mark Rivers
Next: Re: Proposed change to asyn drvAsynIPPort for UDP sockets Henrique Almeida
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Proposed change to asyn drvAsynIPPort for UDP sockets Mark Rivers
Next: Re: Proposed change to asyn drvAsynIPPort for UDP sockets Henrique Almeida
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  <20152016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 16 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·