[PD] ugly "already connected" errors

michael strohmann itsnotfair9 at gmail.com
Fri Jan 25 15:01:25 CET 2019

thanks for the answer!
in order to show that there is a connection betwenn the app to pd i do:

[metro 1000]
[oscformat BlinkingButton/value]
[list prepend send]
[list trim]
|    \
|	[t b]
|	|
|	[disconnect, connect 8000(
|    /
[netsend -u -b] 

now everytime the phone is not available i get:
recv: Connection refused (111)
netsend: Bad file descriptor (9)
warning: 35 removed from poll list but not found

if i dont disconnect before sending i get the “already connected” error.
and if i only connect once and leave the pd side connected, no messages are received on the phone once it leaves the wlan.

messages sent from the phone are almost always received.

in any case it get a console message, either “connecting to port 8000” or “already connected”

i am just concerned because my patch crashes or freezes or create glitchy digital artefacts from time to time, and since it is a 24/7 audio installation i would like it to work.
how to find these bugs...

> On 25 Jan 2019, at 11:50, Roman Haefeli <reduzent at gmail.com> wrote:
> On Fri, 2019-01-25 at 11:31 +0100, michael strohmann wrote:
>> i need to send OSC messages to a number of smartphones via UDP.
>> the phones are used as remote controls for the patch, so i send the
>> status of the patch to the phones every second.
>> since the phones are sometimes out of WLAN reach or switched off, i
>> send a [connect( message to [netsend] every second to keep in touch.
>> and i get loads of “already connected” errors.
> Reconnecting is not necessary, since you are using UDP. UDP has no
> notion of connection. Packets are still sent, even if you switch off
> the receiving devices or if they go out of WLAN reach. Reconnecting
> would only be necessary with a TCP connection and only when one of the
> ends has terminated the connection.
>> this might have caused to fill up the ram on the raspi on which pd
>> runs, so i sent stderr to devnull.
>> still, do you think it is better to disconnect every time before
>> connecting, or might this cause some other problems?
> Although UDP has no notion of connection, the [netsend -u] has. When
> you send another 'connect' message without a previous 'disconnect'
> message, the 'connect' message actually has no effect at all. The same
> connection is still used. The error indicates that a destination has
> already been configured and you need to 'disconnect' first before
> changing the destination.
> To answer your question: If you want to change destination, you _need_
> to disconnect first. However, in your example neither is necessary.
> Just leave the Pd side connected.
> Roman
> _______________________________________________
> Pd-list at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list

More information about the Pd-list mailing list