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?
And: Am I correct assuming that netsend only outputs a message when it got a (send ...) message into its inlet? So there is no way to indicate whether the receiving machine is online unless I keep sending heartbeat/ping messages?
thank you for your help!
P
HI Peter et al -
The netreceive outlet reports the number of netsends currently connected to it. This only gets reported for TCP protocol (UDP doesn't maintain connections).
I don't think netsend reports when an outgoing connection gets closed, but this might be possible to add (and I think it would be useful!)
cheers Miller
On Fri, August 13, 2010 09:06, 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?
And: Am I correct assuming that netsend only outputs a message when it got a (send ...) message into its inlet? So there is no way to indicate whether the receiving machine is online unless I keep sending heartbeat/ping messages?
thank you for your help!
P
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-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
The right outlet indicates that the port is open and the other end is listening.
or does it indicate if a TCP packet arrived at the destination?
And: Am I correct assuming that netsend only outputs a message when it got a (send ...) message into its inlet? So there is no way to indicate whether the receiving machine is online unless I keep sending heartbeat/ping messages?
If the other end drops the connection, then the right outlet will output zero, but it might not happen right away. Especially with wireless it's better to have some kind of heartbeat ping-pong going at a higher level than the OS.
Martin
Thank you Martin, Miller,
please excuse me, I mixed things up when asking. I wanted to know what the outlet of netSEND really indicates. Ups, sorry!
So rephrased:
Does it indicate whether Pd was able to open a port through the OS?
Does it indicate whether a (TCP) packet actually arrived at the receiver?
Does it indicate whether the connection is "alive" (whatever that means)?
Miller, you are right, netsend does not report when a connection got closed, hence my above questions.
best, P
On 08/13/2010 07:25 PM, martin.peach@sympatico.ca wrote:
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
The right outlet indicates that the port is open and the other end is listening.
or does it indicate if a TCP packet arrived at the destination?
And: Am I correct assuming that netsend only outputs a message when it got a (send ...) message into its inlet? So there is no way to indicate whether the receiving machine is online unless I keep sending heartbeat/ping messages?
If the other end drops the connection, then the right outlet will output zero, but it might not happen right away. Especially with wireless it's better to have some kind of heartbeat ping-pong going at a higher level than the OS.
Martin
On 2010-08-14 03:55, Peter Plessas wrote:
please excuse me, I mixed things up when asking. I wanted to know what the outlet of netSEND really indicates. Ups, sorry!
So rephrased:
Does it indicate whether Pd was able to open a port through the OS?
Yes.
Does it indicate whether a (TCP) packet actually arrived at the receiver?
Yes.
Does it indicate whether the connection is "alive" (whatever that means)?
No. It only changes if you try to send a message and it fails. If the other end drops the connection you won't get notified until you attempt to send something. It could take seconds or minutes before the OS decides the message didn't get through.
Martin
Perfect. thank you Martin! P.
On 08/14/2010 04:50 PM, Martin Peach wrote:
On 2010-08-14 03:55, Peter Plessas wrote:
please excuse me, I mixed things up when asking. I wanted to know what the outlet of netSEND really indicates. Ups, sorry!
So rephrased:
Does it indicate whether Pd was able to open a port through the OS?
Yes.
Does it indicate whether a (TCP) packet actually arrived at the receiver?
Yes.
Does it indicate whether the connection is "alive" (whatever that means)?
No. It only changes if you try to send a message and it fails. If the other end drops the connection you won't get notified until you attempt to send something. It could take seconds or minutes before the OS decides the message didn't get through.
Martin
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.