Hi,
I'm trying to control PD from another app over UDP, connecting a netreceive to a messagebox. Now i thought that, if i have a message with
; $1 $2
(cfr. patch below)
i could send for example "testrecv 10", and a receive named testrecv would receive the number. i found out that for some reason you need to send "foo testrecv 10" in stead.. can anyone tell me why? - what's happening to the foo?
test patch (with other messages in stead of the netreceive):
#N canvas 511 168 1262 930 12; #X obj 429 137 r testrecv; #X floatatom 429 165 5 0 0 0 - - -; #X msg 164 130 testrecv 10; #X msg 187 171 foo testrecv 10; #X obj 51 27 netreceive 3000 1; #X text 282 133 fails; #X text 322 173 works; #X msg 191 281 ; $1 $2; #X connect 0 0 1 0; #X connect 2 0 7 0; #X connect 3 0 7 0; #X connect 4 0 7 0;
regards,
kristof
kristof.lauwers@logosfoundation.org
new url!! http://kristoflauwers.de.vu ____________________________________
kristof lauwers wrote:
Hi,
I'm trying to control PD from another app over UDP, connecting a netreceive to a messagebox. Now i thought that, if i have a message with
; $1 $2
(cfr. patch below)
i could send for example "testrecv 10", and a receive named testrecv would receive the number. i found out that for some reason you need to send "foo testrecv 10" in stead.. can anyone tell me why? - what's happening to the foo?
well if you read the console (which is generally a good thing to do) you might notice something like "error: $1: symbol needed as message destination"
it is simple (and has nothing to do with netsend/netreceive) imageine a sequence like "foo bar anything" "foo" is then the header of this sequence, and "bar" & "anything" are the list-items. normally, lists in pd look like "list a sequence 1 23 4" note the header "list" symbols look like "symbol mufti" and so on
now, what does this mean to you ? the message-box "|; $1 $2(" takes the first 2 elements of a sequence. the header is not taken into account. so "foo testreceive 10" is a sequence with header "foo" and elements "testreceive" & "10" (that's what happening with "foo": it is not counted as an element!) "testreceive 10" is a sequence with header "testreceive" and one element "10" (that's why your send-construct fails: "10" is not a valid ID for send/receive, and btw, you don't supply a value to send
why is this so ? don't know maybe historical reasons ? anyhow, you can [route] things to wherever you like with the current implementation. furthermore, it might turn out dangerous to allow sends to every receive, because anybody can send you something like "pd quit" (which might not be what you want)
so, what now ? if you insist on your generic solution and only send pairs "symbol float", why not use
[netreceive 3000 1] | [unpack s 0] | | [pack s 0 ] | [; $1 $2(
mfg.as.dr IOhannes
Greetings all,
On 9 December 2002 at 17:10:31, IOhannes zmoelnig wrote:
kristof lauwers wrote:
Hi,
I'm trying to control PD from another app over UDP, connecting a netreceive to a messagebox. Now i thought that, if i have a message with
; $1 $2
(cfr. patch below)
i could send for example "testrecv 10", and a receive named testrecv would receive the number. i found out that for some reason you need to send "foo testrecv 10" in stead.. can anyone tell me why? - what's happening to the foo?
[snip]
furthermore, it might turn out dangerous to allow sends to every receive, because anybody can send you something like "pd quit" (which might not be what you want)
<plug src="shameless"> if it is however what you want, and if you might have other messages with varying lengths and/or type-distributions, you can always use 'sprinkler': </plug>
|testrecv 10( | [sprinkler]
[r testrecv] | [10\
... marmosets, Bryan
ps - sprinkler is in cvs, otherwise available from me at http://www.ling.uni-potsdam.de/~moocow/projects/pd.