[PD] ugly "already connected" errors

Roman Haefeli reduzent at gmail.com
Fri Jan 25 11:50:57 CET 2019

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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20190125/9b2a3000/attachment.sig>

More information about the Pd-list mailing list