<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">I did some quick hacking/testing and it seems that for UDP:<div class=""><br class=""></div><div class="">* not calling connect() in netsend_connect</div><div class="">* using sendto() with the server address struct in netsend_dosend</div><div class="">* & using recvfrom() instead of recv() in the socketreceiver</div><div class=""><br class=""></div><div class="">results in no "Connection refused" errors being thrown.</div><div class=""><div class=""><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 25, 2019, at 11:32 AM, Christof Ressi <<a href="mailto:christof.ressi@gmx.at" class="">christof.ressi@gmx.at</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><div style="font-family: Verdana;font-size: 12.0px;" class=""><div class="">
<div class="">> For connectionless sending essentially, I think we would need to forego the call to connect() in netsend_connect and keep a copy of the socket address struct</div>

<div class=""> </div>

<div class="">IIUC, 'connect' on a UDP sockket does exactly that: it doesn't really "connect" to anything but just stores the default destination address, so 'connect' + 'send' is equivalent to 'sendto'.</div>

<div class="">at least that's how it has always worked for me.</div>

<div class=""> </div>

<div class=""><a href="http://man7.org/linux/man-pages/man2/connect.2.html" class="">http://man7.org/linux/man-pages/man2/connect.2.html</a></div>

<div class=""> </div>

<div class="">Christof</div>

<div class=""> 
<div name="quote" style="margin:10px 5px 5px 10px; padding: 10px 0 10px 10px; border-left:2px solid #C3D9E5; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div style="margin:0 0 10px 0;" class=""><b class="">Gesendet:</b> Montag, 25. März 2019 um 10:59 Uhr<br class="">
<b class="">Von:</b> "Dan Wilcox" <<a href="mailto:danomatika@gmail.com" class="">danomatika@gmail.com</a>><br class="">
<b class="">An:</b> "Chris McCormick" <<a href="mailto:chris@mccormick.cx" class="">chris@mccormick.cx</a>><br class="">
<b class="">Cc:</b> pd-dev <<a href="mailto:pd-dev@lists.iem.at" class="">pd-dev@lists.iem.at</a>><br class="">
<b class="">Betreff:</b> Re: [PD-dev] netsend/netreceive UDP ignore ECONNREFUSED</div>

<div name="quoted-content" class="">
<div class="">Sure, however neither netsend nor udpsend work this way, so I was first trying to see what I could do without changing the internals a whole lot. It's definitely not "connectionless" when it keeps returning to a receiver...
<div class=""> </div>

<div class="">For connectionless sending essentially, I think we would need to forego the call to connect() in netsend_connect and keep a copy of the socket address struct to use with sendto() instead of send() when actually sending. Since sendto() takes the address directly, it doesn't need a connect() ahead of time. Also, the UDP netsend / netreceive relay behavior could then use sendto() and recvfrom().</div>

<div class=""> </div>

<div class="">So conceptually, the current behavior of calling connect() for both UDP and TCP needs to change and I'd think then the the "connected" outlet for UDP simply means the socket is set up, but has no connotation for a current "connection." Again, I'm not sure how that would affect patches which would rely on the old behavior...
<div class=""> 
<blockquote class="">
<div class="">On Mar 25, 2019, at 3:42 AM, Chris McCormick <<a href="mailto:chris@mccormick.cx" target="_blank" class="">chris@mccormick.cx</a>> wrote:</div>
 

<div class="">
<div class="">Hi Dan,<br class="">
<br class="">
On 23/3/19 5:56 am, Dan Wilcox wrote:
<blockquote class="">From my reading on the socket API, sending a UDP message conceptually shouldn't care about whether the receiver is there. However this is detected on a lower networking layer and propagated up to the application layer where it can be used or ignored.</blockquote>
<br class="">
You probably know this already but it is possible to operate UDP in connectionless or connection-oriented mode. Connection-oriented is somewhere between TCP and connectionless. In connection-oriented mode I suppose you would want to know if the other side is there or not, whereas with connectionless you probably just want to fire and forget. Not sure if this affects what you are doing but might help explain what you're seeing.<br class="">
<br class="">
Cheers,<br class="">
<br class="">
Chris.<br class="">
<br class="">
--<br class="">
<a href="https://mccormick.cx/" target="_blank" class="">https://mccormick.cx/</a><br class="">
<br class="">
My tech development newsletter:<br class="">
<a href="https://mccormick.cx/subscribe" target="_blank" class="">https://mccormick.cx/subscribe</a></div>
</div>
</blockquote>
</div>
 

<div class="">
<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">--------</div>

<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class="">Dan Wilcox</div>

<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="http://twitter.com/danomatika" target="_blank" class="">@danomatika</a></div>

<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="http://danomatika.com/" target="_blank" class="">danomatika.com</a></div>

<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""><a href="http://robotcowboy.com/" target="_blank" class="">robotcowboy.com</a></div>

<div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-weight: normal; letter-spacing: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;" class=""> </div>
</div>
</div>
_______________________________________________ Pd-dev mailing list <a href="mailto:Pd-dev@lists.iem.at" class="">Pd-dev@lists.iem.at</a> <a href="https://lists.puredata.info/listinfo/pd-dev" target="_blank" class="">https://lists.puredata.info/listinfo/pd-dev</a></div>
</div>
</div>
</div>
</div></div></div>
</div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">--------</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Dan Wilcox</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a href="http://twitter.com/danomatika" class="">@danomatika</a></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a href="http://danomatika.com" class="">danomatika.com</a></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><a href="http://robotcowboy.com" class="">robotcowboy.com</a></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<br class=""></div></div></div></body></html>