Howdy all,

I've been making some proposal work for updates to netsend/netreceive.

One issue is making UDP sending ignore connection refused errors. I have this 
working by catching the return value from recv():

        /* keep UDP alive */
    if (sys_sockerrno() == ECONNREFUSED && x->x_protocol == SOCK_DGRAM)
        return;

(I added sys_sockerrno() to return the socket errno.)

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.

My questions are:

1. Should this ignore silently and not close the connection? I notice mrpeach 
[udpsend] seems to ignores the first try, then closes the socket on the next 
failure. However, I like keeping the socket as no errors are thrown and you can 
easily break than re-establish UDP sending/receiving. This works well with the 
[netsend] dst & source relays.

2. Should this be a creation argument, say -k? I imagine there are plenty of 
patches which expect the socket to be closed automatically and respond to a 0 
from the connection outlet. On the other hand, as UDP is "connectionless" my 
thinking is that the conceptual "connection" of a UDP [netsend] (aka outlet) 
refers to the internal socket and not necessarily that the destination is 
reachable. With TCP, the connection state more obviously refers to 1-1 
connection with the other side.

--------
Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com/>
robotcowboy.com <http://robotcowboy.com/>



_______________________________________________
Pd-dev mailing list
[email protected]
https://lists.puredata.info/listinfo/pd-dev

Reply via email to