[PD] exact meaning of netsend outlet

Matteo Sisti Sette matteosistisette at gmail.com
Mon Aug 16 13:11:48 CEST 2010


On 08/13/2010 06:06 PM, Peter Plessas wrote:
> Dear list,
>
> wondering what the exact meaning of the outlet of [netreceive] in TCP
> mode is:
>
> Does it indicate whether Pd through the OS was able to open a port
> or
> does it indicate if a TCP packet arrived at the destination?
>

Seems you meant the outlet of [netsend]

It indicates whether a connection has been established with the other 
side (the listening [netreceive]).

You never get any confirmation that a particular message has been 
received; in TCP all packets are supposed to be received (and in the 
order they were sent) while the connection is active (if a packet got 
lost, it would be detected and retransmitted, all "silently"/transparently)


When the connection gets closed, [netsend] will output a zero, but as 
Martin and Miller noted, if it gets closed by the server, the zero won't 
be output immediately but only when netsend "realises" it (which is not 
as soon as it _could_ realise it): this usually (if not always) happens 
the next time you try to send a message.

As Miller says it would be entirely possible to detect immediately when 
the connection is closed by the other side, and I would say it is 
"necessary" rather than "useful", since this is also what one expects by 
reading the help patch:

"Outlet is nonzero if connection is open, zero otherwise"


So right now, the only way to _reliably_ know whether the connection is 
active is, as you suggest, to periodically send "ping" messages, though 
you probably don't need the server to reply to them and the client to 
check, since when you try to send and the connection is closed, 
[netsend] will "wake up" and output a 0.



More information about the Pd-list mailing list