Revision: 10527 http://pure-data.svn.sourceforge.net/pure-data/?rev=10527&view=rev Author: mrpeach Date: 2009-01-13 14:03:33 +0000 (Tue, 13 Jan 2009)
Log Message: ----------- This is Roman Haefeli's tcpsocketserver for FUDI and OSC. Untested!
Added Paths: ----------- trunk/externals/mrpeach/osc/tcpsocket.FUDI.pd trunk/externals/mrpeach/osc/tcpsocket.OSC.pd trunk/externals/mrpeach/osc/tcpsocketserver-help.pd trunk/externals/mrpeach/osc/tcpsocketserver.pd
Added: trunk/externals/mrpeach/osc/tcpsocket.FUDI.pd =================================================================== --- trunk/externals/mrpeach/osc/tcpsocket.FUDI.pd (rev 0) +++ trunk/externals/mrpeach/osc/tcpsocket.FUDI.pd 2009-01-13 14:03:33 UTC (rev 10527) @@ -0,0 +1,132 @@ +#N canvas 585 75 446 533 10; +#X obj 50 49 == $2; +#X obj 7 28 route in socket; +#X obj 7 76 spigot; +#N canvas 622 183 512 335 reset 0; +#X obj 23 41 route $2; +#X obj 23 63 route reset; +#X obj 23 83 t b b; +#X msg 55 170 done; +#X obj 23 113 outlet; +#X text 161 33 this is used to:; +#X text 87 114 a) reset the sockethandler on a new connection; +#X text 88 129 (for instance , if the previous connection was quitted +in the middle of a packet).; +#X text 55 213 b) check for the socketserver , if a sockethandler +on specified socket already exists.; +#X obj 55 191 s $1.TCPSOCKET; +#X obj 23 19 r $1.TCPSOCKET; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 3 0 9 0; +#X connect 10 0 0 0; +#X restore 46 102 pd reset; +#X obj 105 279 route socket ip; +#X obj 41 367 list append; +#X obj 58 323 list append; +#X obj 7 299 t a b b b; +#X obj 7 414 list prepend out; +#X obj 41 391 list prepend socket.out; +#X obj 58 345 list prepend ip.out; +#X obj 7 442 list trim; +#X text 16 220 the lower part makes [tcpsocketserver] behave like [tcpserver] +; +#X obj -2 136 cnv 15 450 70 empty empty empty 20 12 0 14 -204786 -66577 +0; +#N canvas 385 67 454 323 FUDI 0; +#X obj 23 6 inlet; +#X obj 23 284 outlet; +#N canvas 389 242 220 273 serialize 0; +#X obj 5 72 t a a; +#X obj 37 94 list prepend 0; +#X obj 37 115 s $0.inbuffer; +#X obj 5 135 list length; +#X obj 5 179 until; +#X obj 5 156 t a b; +#X obj 5 202 f; +#X obj 50 205 + 1; +#X msg 49 179 0; +#X obj 5 228 tabread $0.inbuffer; +#X obj 5 50 inlet; +#X obj 5 250 outlet; +#X obj 5 12 table $0.inbuffer 1024; +#X connect 0 0 3 0; +#X connect 0 1 1 0; +#X connect 1 0 2 0; +#X connect 3 0 5 0; +#X connect 4 0 6 0; +#X connect 5 0 4 0; +#X connect 5 1 8 0; +#X connect 6 0 7 0; +#X connect 6 0 9 0; +#X connect 7 0 6 1; +#X connect 8 0 6 1; +#X connect 9 0 11 0; +#X connect 10 0 0 0; +#X restore 23 30 pd serialize; +#X obj 23 109 t a a; +#X obj 97 181 list prepend; +#X obj 195 180 t a; +#X obj 23 211 list append; +#X obj 23 234 t a b; +#X obj 160 56 inlet; +#X text 210 56 reset; +#X obj 23 53 sel 10 13; +#X msg 23 76 32; +#X obj 23 133 sel 59; +#X text 83 134 asci: semicolon is used as a delimiter; +#X obj 160 152 b; +#X obj 23 257 list append 10; +#X connect 0 0 2 0; +#X connect 2 0 10 0; +#X connect 3 0 12 0; +#X connect 3 1 4 0; +#X connect 4 0 5 0; +#X connect 4 0 6 1; +#X connect 5 0 4 1; +#X connect 6 0 7 0; +#X connect 7 0 15 0; +#X connect 7 1 6 1; +#X connect 7 1 4 1; +#X connect 8 0 14 0; +#X connect 10 0 11 0; +#X connect 10 1 11 0; +#X connect 10 2 3 0; +#X connect 11 0 3 0; +#X connect 12 0 6 0; +#X connect 14 0 4 1; +#X connect 14 0 6 1; +#X connect 15 0 1 0; +#X restore 7 161 pd FUDI; +#X text 70 162 <- PUT HERE THE PROTOCOL SPECIFIC DELIMITER CODE; +#X text 15 197 -------------------------------------------------------- +; +#X text 12 129 -------------------------------------------------------- +; +#X obj 7 6 r $1.TCPSOCKET; +#X obj 7 465 s $1.TCPSOCKET; +#X obj 105 255 r $1.TCPSOCKET; +#X text 200 454 Author: Roman Haefeli; +#X text 201 474 Version: 2009-01-11; +#X text 50 74 <- only pass stream of own socket; +#X connect 0 0 2 1; +#X connect 1 0 2 0; +#X connect 1 1 0 0; +#X connect 2 0 14 0; +#X connect 3 0 14 1; +#X connect 4 0 5 1; +#X connect 4 1 6 1; +#X connect 5 0 9 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 2 5 0; +#X connect 7 3 6 0; +#X connect 8 0 11 0; +#X connect 9 0 11 0; +#X connect 10 0 11 0; +#X connect 11 0 19 0; +#X connect 14 0 7 0; +#X connect 18 0 1 0; +#X connect 20 0 4 0;
Added: trunk/externals/mrpeach/osc/tcpsocket.OSC.pd =================================================================== --- trunk/externals/mrpeach/osc/tcpsocket.OSC.pd (rev 0) +++ trunk/externals/mrpeach/osc/tcpsocket.OSC.pd 2009-01-13 14:03:33 UTC (rev 10527) @@ -0,0 +1,225 @@ +#N canvas 585 75 446 533 10; +#X obj 50 49 == $2; +#X obj 7 28 route in socket; +#X obj 7 76 spigot; +#N canvas 622 183 512 335 reset 0; +#X obj 23 41 route $2; +#X obj 23 63 route reset; +#X obj 23 83 t b b; +#X msg 55 170 done; +#X obj 23 113 outlet; +#X text 161 33 this is used to:; +#X text 87 114 a) reset the sockethandler on a new connection; +#X text 88 129 (for instance , if the previous connection was quitted +in the middle of a packet).; +#X text 55 213 b) check for the socketserver , if a sockethandler +on specified socket already exists.; +#X obj 55 191 s $1.TCPSOCKET; +#X obj 23 19 r $1.TCPSOCKET; +#X connect 0 0 1 0; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 2 1 3 0; +#X connect 3 0 9 0; +#X connect 10 0 0 0; +#X restore 40 102 pd reset; +#X obj 104 280 route socket ip; +#X obj 41 367 list append; +#X obj 58 323 list append; +#X obj 7 299 t a b b b; +#X obj 7 414 list prepend out; +#X obj 41 391 list prepend socket.out; +#X obj 58 345 list prepend ip.out; +#X obj 7 442 list trim; +#X text 16 220 the lower part makes [tcpsocketserver] behave like [tcpserver] +; +#X obj -2 136 cnv 15 450 70 empty empty empty 20 12 0 14 -204786 -66577 +0; +#X text 70 162 <- PUT HERE THE PROTOCOL SPECIFIC DELIMITER CODE; +#X text 15 197 -------------------------------------------------------- +; +#X text 13 129 -------------------------------------------------------- +; +#X obj 7 6 r $1.TCPSOCKET; +#X obj 7 465 s $1.TCPSOCKET; +#X obj 104 256 r $1.TCPSOCKET; +#X text 200 454 Author: Roman Haefeli; +#X text 201 474 Version: 2009-01-11; +#X text 55 75 <- only pass stream of own socket; +#N canvas 395 78 268 176 OSC 0; +#X obj 27 18 inlet; +#X obj 27 156 outlet; +#X obj 144 23 inlet; +#X text 194 23 reset; +#N canvas 628 406 424 313 drip 0; +#X obj 12 15 inlet; +#X obj 12 226 outlet; +#X obj 107 16 table $0.buffer 65536; +#X obj 76 82 s $0.buffer; +#X obj 76 61 list prepend 0; +#X obj 12 37 t a a; +#X text 9 265 this 'drip' approach might use more memory , but hopefully +less cpu cycles.; +#X obj 12 102 list length; +#X obj 12 150 until; +#X obj 12 126 t a b; +#X obj 12 173 f; +#X obj 60 176 + 1; +#X msg 61 150 0; +#X obj 12 202 tabread $0.buffer; +#X connect 0 0 5 0; +#X connect 4 0 3 0; +#X connect 5 0 7 0; +#X connect 5 1 4 0; +#X connect 7 0 9 0; +#X connect 8 0 10 0; +#X connect 9 0 8 0; +#X connect 9 1 12 0; +#X connect 10 0 11 0; +#X connect 10 0 13 0; +#X connect 11 0 10 1; +#X connect 12 0 10 1; +#X connect 13 0 1 0; +#X restore 27 49 pd drip; +#N canvas 820 354 408 355 parse_frameheader 0; +#X obj 14 10 inlet; +#X obj 14 304 outlet; +#X obj 322 178 outlet; +#X obj 134 228 list prepend; +#X obj 230 228 t a; +#X obj 14 43 list prepend 0; +#X obj 14 123 f; +#X obj 14 144 + 1; +#X obj 14 166 sel 4; +#X obj 14 99 t b a; +#X obj 14 69 route 0 1; +#X text 97 64 0 = frame header; +#X text 97 80 1 = frame content; +#X obj 14 187 t b b; +#X obj 109 22 r $0.route; +#X obj 46 230 s $0.route; +#X msg 46 208 1; +#X obj 14 261 list append; +#X obj 243 18 inlet; +#X obj 243 44 b; +#X msg 272 45 0; +#X obj 272 65 s $0.route; +#N canvas 504 266 169 262 MSB_2SB_3SB_LSB->float 0; +#X obj 7 10 inlet; +#X obj 7 214 outlet; +#X obj 7 33 unpack f f f f; +#X obj 70 74 << 8; +#X obj 38 118 << 16; +#X obj 7 165 << 24; +#X obj 70 98 +; +#X obj 38 139 +; +#X obj 7 190 +; +#X connect 0 0 2 0; +#X connect 2 0 5 0; +#X connect 2 1 4 0; +#X connect 2 2 3 0; +#X connect 2 3 6 1; +#X connect 3 0 6 0; +#X connect 4 0 7 0; +#X connect 5 0 8 0; +#X connect 6 0 7 1; +#X connect 7 0 8 1; +#X connect 8 0 1 0; +#X restore 14 282 pd MSB_2SB_3SB_LSB->float; +#X text 288 19 new packet; +#X text 23 327 frame length; +#X text 322 201 data stream; +#X connect 0 0 5 0; +#X connect 3 0 4 0; +#X connect 3 0 17 1; +#X connect 4 0 3 1; +#X connect 5 0 10 0; +#X connect 6 0 7 0; +#X connect 7 0 6 1; +#X connect 7 0 8 0; +#X connect 8 0 13 0; +#X connect 9 0 6 0; +#X connect 9 1 3 0; +#X connect 10 0 9 0; +#X connect 10 1 2 0; +#X connect 13 0 17 0; +#X connect 13 1 16 0; +#X connect 14 0 5 1; +#X connect 16 0 15 0; +#X connect 17 0 22 0; +#X connect 18 0 19 0; +#X connect 18 0 20 0; +#X connect 19 0 3 1; +#X connect 20 0 21 0; +#X connect 20 0 6 1; +#X connect 22 0 1 0; +#X restore 27 77 pd parse_frameheader; +#N canvas 748 498 450 300 form_packet 0; +#X obj 68 23 inlet; +#X text 106 24 length; +#X obj 194 22 inlet; +#X text 244 23 stream; +#X obj 120 190 list prepend; +#X obj 216 190 t a; +#X obj 14 123 f; +#X obj 14 144 + 1; +#X obj 14 99 t b a; +#X obj 14 187 t b b; +#X obj 46 213 list append; +#X obj 14 166 sel 0; +#X obj 46 253 outlet; +#X text 100 254 OSC packet; +#X text 261 262 EOP; +#X obj 210 261 outlet; +#X obj 68 88 t b a; +#X msg 68 111 0; +#X connect 0 0 16 0; +#X connect 2 0 8 0; +#X connect 4 0 5 0; +#X connect 4 0 10 1; +#X connect 5 0 4 1; +#X connect 6 0 7 0; +#X connect 7 0 6 1; +#X connect 7 0 11 0; +#X connect 8 0 6 0; +#X connect 8 1 4 0; +#X connect 9 0 15 0; +#X connect 9 1 10 0; +#X connect 10 0 12 0; +#X connect 11 0 9 0; +#X connect 16 0 17 0; +#X connect 16 0 4 1; +#X connect 16 1 11 1; +#X connect 17 0 6 1; +#X restore 27 129 pd form_packet; +#X obj 169 85 b; +#X obj 144 50 b; +#X connect 0 0 4 0; +#X connect 2 0 8 0; +#X connect 4 0 5 0; +#X connect 5 0 6 0; +#X connect 5 1 6 1; +#X connect 6 0 1 0; +#X connect 6 1 7 0; +#X connect 7 0 5 1; +#X connect 8 0 5 1; +#X restore 7 161 pd OSC; +#X connect 0 0 2 1; +#X connect 1 0 2 0; +#X connect 1 1 0 0; +#X connect 2 0 23 0; +#X connect 3 0 23 1; +#X connect 4 0 5 1; +#X connect 4 1 6 1; +#X connect 5 0 9 0; +#X connect 6 0 10 0; +#X connect 7 0 8 0; +#X connect 7 2 5 0; +#X connect 7 3 6 0; +#X connect 8 0 11 0; +#X connect 9 0 11 0; +#X connect 10 0 11 0; +#X connect 11 0 18 0; +#X connect 17 0 1 0; +#X connect 19 0 4 0; +#X connect 23 0 7 0;
Added: trunk/externals/mrpeach/osc/tcpsocketserver-help.pd =================================================================== --- trunk/externals/mrpeach/osc/tcpsocketserver-help.pd (rev 0) +++ trunk/externals/mrpeach/osc/tcpsocketserver-help.pd 2009-01-13 14:03:33 UTC (rev 10527) @@ -0,0 +1,301 @@ +#N canvas 35 3 878 523 10; +#X declare -stdpath extra/mrpeach; +#X declare -stdlib extra/pdstring declare -stdlib extra/maxlib; +#X declare -stdpath extra/mrpeach; +#X declare -stdlib extra/pdstring declare -stdlib extra/maxlib; +#X declare -stdpath extra/mrpeach; +#X msg 471 74 print; +#X text 521 75 list of connections; +#X text 627 103 send to all clients; +#X text 629 132 send to client 1; +#X text 615 155 send to client on socket 504; +#X text 613 28 'send' prefix is optional; +#X text 474 48 (the first number is socket number); +#X msg 556 257 disconnectsocket $1; +#X msg 484 284 disconnectclient $1; +#X floatatom 506 215 5 0 0 0 - - -; +#X obj 484 235 f; +#X obj 484 216 bng 15 250 50 0 empty empty empty 17 7 0 10 -258699 +-241291 -1; +#X floatatom 578 216 5 0 0 0 - - -; +#X obj 556 235 f; +#X obj 556 216 bng 15 250 50 0 empty empty empty 17 7 0 10 -258699 +-241291 -1; +#X text 483 197 disconnect by socket or client number; +#X obj 618 335 unpack 0 0 0 0; +#X floatatom 618 355 3 0 0 0 - - -; +#X floatatom 649 355 3 0 0 0 - - -; +#X floatatom 681 356 3 0 0 0 - - -; +#X floatatom 715 356 3 0 0 0 - - -; +#X text 616 372 IP; +#X floatatom 569 355 5 0 0 0 - - -; +#X text 566 371 socket; +#X floatatom 520 376 5 0 0 0 - - -; +#X text 520 391 number of connections; +#X obj 471 433 spigot; +#X obj 510 413 tgl 15 0 empty empty enable_print 17 7 0 10 -24198 -258699 +-258699 0 1; +#X text 15 37 [tcpsocketserver <protocol> <port>]; +#X obj 469 311 cnv 15 185 22 empty empty empty 20 12 0 14 -204786 -66577 +0; +#X obj 471 314 tcpsocketserver FUDI 2468; +#X text 15 115 [tcpsocketserver] is able to handle multiple sockets +of a packet oriented protocol correctly , unlike [tcpserver] , which +might mix up packets from different sockets.; +#X text 24 308 - OSC; +#X text 16 245 each protocol requires its own specific socket handler +abstraction , which should be named [tcpsocket.PROTOCOL]. currently +available are the protocols:; +#X text 23 293 - FUDI; +#N canvas 704 167 472 356 EXTENDABILITY 0; +#X text 3 39 Support for more protocols can easily be added. In order +to do so:; +#X text 5 10 EXTENDABILITY; +#X text 6 105 - open tcpsocket.NEWPROTOCOL.pd; +#X text 7 127 - edit the green-marked subpatch; +#X text 10 208 - save it; +#X text 12 227 - in order to use it , instantiate:; +#X text 46 247 [tcpsocketserver NEWPROTOCOL <port>]; +#X text 8 148 - replace code with code , that creates proper packets +out of the incoming stream for the desired protocol. don't forget to +implement a reset mechanism , in case a socket is closed in the middle +of packet transmission.; +#X text 5 83 - copy tcpsocket.FUDI.pd to tcpsocket.NEWPROTOCOL.pd; +#X restore 21 387 pd EXTENDABILITY; +#X text 17 453 Author: Roman Haefeli; +#X text 16 468 Version: 2009-01-11; +#X text 15 65 [tcpsocketserver] is meant to be a protocol-aware drop-in +replacement for [tcpserver]. it uses same the same inlet and outlet +configuration as [tcpserver].; +#X text 469 478 only well-formed FUDI messages are received here.; +#N canvas 469 232 147 274 EXAMPLES 0; +#N canvas 231 0 579 756 FUDI 0; +#X obj 9 39 cnv 15 550 240 empty empty client_1 20 12 0 14 -249661 +-66577 0; +#X obj 25 193 tcpclient; +#X msg 369 94 connect localhost 11001; +#X msg 393 115 disconnect; +#X obj 369 72 sel 1 0; +#X obj 369 51 tgl 15 0 empty empty empty 17 7 0 10 -261234 -1 -1 0 +1; +#X obj 25 259 print CLIENT_1; +#X msg 25 70 one two; +#X obj 25 91 any2string 0 -1; +#X msg 69 151 59 10; +#X msg 33 117 32 116 104 114 101 101 23; +#X obj 9 286 cnv 15 550 150 empty empty client_2 20 12 0 14 -249661 +-66577 0; +#X msg 369 341 connect localhost 11001; +#X msg 393 362 disconnect; +#X obj 369 319 sel 1 0; +#X obj 369 298 tgl 15 0 empty empty empty 17 7 0 10 -261234 -1 -1 0 +1; +#X obj 25 214 string2any 0 59; +#X obj 25 234 route bang; +#X obj 25 373 netclient; +#X obj 8 9 declare -stdlib extra/pdstring declare -stdlib extra/maxlib +; +#X obj 25 402 print CLIENT_2; +#X text 169 324 <- send FUDI message; +#X obj 10 444 cnv 15 550 300 empty empty FUDI_server 20 12 0 14 -241408 +-66577 0; +#X obj 12 600 tcpsocketserver FUDI 11001; +#X obj 12 674 string2any 0 59; +#X obj 12 695 route bang; +#X obj 191 620 unpack 0 0 0 0; +#X floatatom 191 640 3 0 0 0 - - -; +#X floatatom 222 640 3 0 0 0 - - -; +#X floatatom 254 641 3 0 0 0 - - -; +#X floatatom 288 641 3 0 0 0 - - -; +#X text 189 657 IP; +#X floatatom 131 640 5 0 0 0 - - -; +#X floatatom 71 641 5 0 0 0 - - -; +#X text 60 656 clients; +#X text 127 656 socket; +#X text 132 675 <--; +#X text 165 675 [tcpsocketserver FUDI] does _not_ remove the trailing +' ; '; +#X text 165 70 1) start a FUDI message; +#X text 232 118 2) continue; +#X text 118 152 3) finish FUDI message (with semicolon - newline); +#X text 391 52 connect; +#X text 390 296 connect; +#X text 20 475 [tcpsocketserver FUDI] doesn't take care of building +FUDI-compliant messages. this should be done by the user.; +#X text 154 216 4) try sending a message from client_2 during composing +a message with client_1 and see , how the server behaves.; +#X text 279 522 <- this doesn't work; +#X text 315 549 <- this should; +#X msg 25 323 send four five six; +#X msg 43 550 client 2 115 101 118 101 110 32 59 10; +#X msg 42 521 client 2 115 101 118 101 110 32; +#X obj 12 720 print SERVER; +#X connect 1 0 16 0; +#X connect 2 0 1 0; +#X connect 3 0 1 0; +#X connect 4 0 2 0; +#X connect 4 1 3 0; +#X connect 5 0 4 0; +#X connect 7 0 8 0; +#X connect 8 0 1 0; +#X connect 9 0 1 0; +#X connect 10 0 1 0; +#X connect 12 0 18 0; +#X connect 13 0 18 0; +#X connect 14 0 12 0; +#X connect 14 1 13 0; +#X connect 15 0 14 0; +#X connect 16 0 17 0; +#X connect 17 1 6 0; +#X connect 18 0 20 0; +#X connect 23 0 24 0; +#X connect 23 1 33 0; +#X connect 23 2 32 0; +#X connect 23 3 26 0; +#X connect 24 0 25 0; +#X connect 25 1 50 0; +#X connect 26 0 27 0; +#X connect 26 1 28 0; +#X connect 26 2 29 0; +#X connect 26 3 30 0; +#X connect 47 0 18 0; +#X connect 48 0 23 0; +#X connect 49 0 23 0; +#X restore 23 25 pd FUDI; +#N canvas 231 0 579 756 OSC 0; +#X obj 9 39 cnv 15 550 240 empty empty client_1 20 12 0 14 -249661 +-66577 0; +#X obj 25 211 tcpclient; +#X msg 357 229 disconnect; +#X obj 333 186 sel 1 0; +#X obj 333 165 tgl 15 0 empty empty empty 17 7 0 10 -261234 -1 -1 0 +1; +#X obj 25 259 print CLIENT_1; +#X obj 9 286 cnv 15 550 150 empty empty client_2 20 12 0 14 -249661 +-66577 0; +#X msg 393 362 disconnect; +#X obj 369 319 sel 1 0; +#X obj 369 298 tgl 15 0 empty empty empty 17 7 0 10 -261234 -1 -1 0 +1; +#X obj 8 9 declare -stdlib extra/pdstring declare -stdlib extra/maxlib +; +#X obj 25 417 print CLIENT_2; +#X obj 10 444 cnv 15 550 300 empty empty OSC_server 20 12 0 14 -241408 +-66577 0; +#X obj 188 636 unpack 0 0 0 0; +#X floatatom 188 656 3 0 0 0 - - -; +#X floatatom 219 656 3 0 0 0 - - -; +#X floatatom 251 657 3 0 0 0 - - -; +#X floatatom 285 657 3 0 0 0 - - -; +#X text 186 673 IP; +#X floatatom 130 656 5 0 0 0 - - -; +#X floatatom 73 657 5 0 0 0 - - -; +#X text 62 672 clients; +#X text 126 672 socket; +#X text 355 166 connect; +#X text 390 296 connect; +#X obj 16 616 tcpsocketserver OSC 11002; +#X obj 16 694 unpackOSC; +#X obj 16 720 print SERVER; +#X msg 333 208 connect localhost 11002; +#X msg 369 341 connect localhost 11002; +#X obj 25 234 unpackOSCstream; +#X obj 25 373 tcpclient; +#X obj 25 395 unpackOSCstream; +#X msg 49 498 /synth1/tone3/freq 440; +#X msg 25 79 0 0 0 16 47 102 114 101 113; +#X msg 41 104 0 0 0 44 105 0 0 0 0 1 184; +#X text 155 324 send OSC message; +#X msg 25 323 /amplitude 0.78; +#X obj 25 347 packOSCstream; +#X obj 16 522 packOSCstream; +#X obj 16 594 list trim; +#X msg 16 473 /synth3/tone4/amplitude 0.36; +#X obj 180 555 hradio 15 1 0 2 empty empty empty 0 -8 0 10 -4034 -1 +-1 0; +#X obj 180 573 + 1; +#X text 221 555 client; +#X obj 16 551 list prepend 1; +#X obj 16 573 list prepend client; +#X text 236 80 1) start sending an OSC packet; +#X text 247 106 2) complete the OSC packet; +#X text 59 137 also try sending an OSC packet from client_2 between +1) and 2); +#X text 124 520 <- use [packOSCstream] in order to create OSC packets +suitable for tcp transport.; +#X text 238 486 send to clients; +#X text 93 695 <---; +#X text 139 694 CAUTION: not [unpackOSCstream] is used here , since +[tcpsocket.OSC] already removes the 4-byte header.; +#X connect 1 0 30 0; +#X connect 2 0 1 0; +#X connect 3 0 28 0; +#X connect 3 1 2 0; +#X connect 4 0 3 0; +#X connect 7 0 31 0; +#X connect 8 0 29 0; +#X connect 8 1 7 0; +#X connect 9 0 8 0; +#X connect 13 0 14 0; +#X connect 13 1 15 0; +#X connect 13 2 16 0; +#X connect 13 3 17 0; +#X connect 25 0 26 0; +#X connect 25 1 20 0; +#X connect 25 2 19 0; +#X connect 25 3 13 0; +#X connect 26 0 27 0; +#X connect 28 0 1 0; +#X connect 29 0 31 0; +#X connect 30 0 5 0; +#X connect 31 0 32 0; +#X connect 32 0 11 0; +#X connect 33 0 39 0; +#X connect 34 0 1 0; +#X connect 35 0 1 0; +#X connect 37 0 38 0; +#X connect 38 0 31 0; +#X connect 39 0 45 0; +#X connect 40 0 25 0; +#X connect 41 0 39 0; +#X connect 42 0 43 0; +#X connect 43 0 45 1; +#X connect 45 0 46 0; +#X connect 46 0 40 0; +#X restore 23 49 pd OSC; +#X restore 21 365 pd EXAMPLES; +#X obj 471 455 print FUDI; +#X msg 471 101 broadcast 97 98 99 59 10; +#X msg 471 128 client 1 97 98 99 59 10; +#X msg 471 155 send 504 97 98 99 59 10; +#X msg 471 28 10 97 98 99 59 10; +#X text 17 8 TCPSOCKETSERVER - a protocol-aware wrapper aroun [tcpserver] +; +#X text 13 167 [tcpsocketserver] dynamically creates (internally) an +instance of a socket handler abstraction [tcpsocket.PROTOCOL] for each +opened socket. every socket handler creates proper packets from the +incoming stream and sends them to the left outlet of [tcpsocketserver]. +; +#X connect 0 0 30 0; +#X connect 7 0 30 0; +#X connect 8 0 30 0; +#X connect 9 0 10 1; +#X connect 10 0 8 0; +#X connect 11 0 10 0; +#X connect 12 0 13 1; +#X connect 13 0 7 0; +#X connect 14 0 13 0; +#X connect 16 0 17 0; +#X connect 16 1 18 0; +#X connect 16 2 19 0; +#X connect 16 3 20 0; +#X connect 26 0 41 0; +#X connect 27 0 26 1; +#X connect 30 0 26 0; +#X connect 30 1 24 0; +#X connect 30 2 22 0; +#X connect 30 3 16 0; +#X connect 42 0 30 0; +#X connect 43 0 30 0; +#X connect 44 0 30 0; +#X connect 45 0 30 0;
Added: trunk/externals/mrpeach/osc/tcpsocketserver.pd =================================================================== --- trunk/externals/mrpeach/osc/tcpsocketserver.pd (rev 0) +++ trunk/externals/mrpeach/osc/tcpsocketserver.pd 2009-01-13 14:03:33 UTC (rev 10527) @@ -0,0 +1,106 @@ +#N canvas 332 12 333 552 10; +#X declare -stdpath extra/mrpeach; +#X obj 13 39 inlet; +#X obj 13 464 outlet; +#X obj 75 463 outlet; +#X obj 137 463 outlet; +#X obj 199 462 outlet; +#X obj 36 187 list trim; +#X obj 59 145 list trim; +#X obj 59 124 list prepend socket; +#X obj 36 166 list prepend num_of_clients; +#X obj 82 103 list trim; +#X obj 82 82 list prepend ip; +#N canvas 816 227 247 348 $0.TCPSOCKETCONTAINER 0; +#X restore 14 372 pd $0.TCPSOCKETCONTAINER; +#N canvas 491 218 502 504 socketmanager 0; +#X msg 24 196 $1 reset; +#X obj 25 259 route done; +#X obj 5 175 t a a b; +#X msg 25 280 0; +#X msg 44 280 1; +#X obj 5 303 spigot; +#X obj 44 344 f; +#X obj 76 344 + 20; +#X obj 5 323 t a b b; +#X obj 24 365 list append $1; +#X obj 24 388 list append; +#X obj 5 412 list append; +#X obj 5 476 s pd-$0.TCPSOCKETCONTAINER; +#X obj 5 432 list append $0; +#X obj 5 24 route socket num_of_clients; +#X obj 84 46 t a a; +#X obj 69 73 -; +#X obj 69 94 == 1; +#X obj 5 122 spigot; +#X obj 5 3 r $0.TCPSOCKET; +#X obj 24 217 s $0.TCPSOCKET; +#X obj 25 238 r $0.TCPSOCKET; +#X msg 5 454 obj 10 $3 tcpsocket.$2 $4 $1 , loadbang; +#X obj 5 148 t a b; +#X msg 65 132 0; +#X text 116 78 when a new client connects (num_of_clients: +1); +#X text 119 197 send a 'reset' to the according socket handler; +#X text 114 266 and if it doesn't respond (which means , there is +no socket handler on specified socket) ,; +#X text 119 368 create one (into pd-$0.TCPSOCKETCONTAINER).; +#X connect 0 0 20 0; +#X connect 1 0 3 0; +#X connect 2 0 5 0; +#X connect 2 1 0 0; +#X connect 2 2 4 0; +#X connect 3 0 5 1; +#X connect 4 0 5 1; +#X connect 5 0 8 0; +#X connect 6 0 7 0; +#X connect 6 0 10 1; +#X connect 7 0 6 1; +#X connect 8 0 11 0; +#X connect 8 1 9 0; +#X connect 8 2 6 0; +#X connect 9 0 10 0; +#X connect 10 0 11 1; +#X connect 11 0 13 0; +#X connect 13 0 22 0; +#X connect 14 0 18 0; +#X connect 14 1 15 0; +#X connect 15 0 16 1; +#X connect 15 1 16 0; +#X connect 16 0 17 0; +#X connect 17 0 18 1; +#X connect 18 0 23 0; +#X connect 19 0 14 0; +#X connect 21 0 1 0; +#X connect 22 0 12 0; +#X connect 23 0 2 0; +#X connect 23 1 24 0; +#X connect 24 0 18 1; +#X restore 14 349 pd socketmanager; +#X obj 13 60 tcpserver $2; +#X obj 13 417 r $0.TCPSOCKET; +#X obj 13 208 list prepend in; +#X obj 13 440 route out num_of_clients socket.out ip.out; +#X obj 13 230 list trim; +#X obj 82 316 s $0.TCPSOCKET; +#X text 23 501 Author: Roman Haefeli; +#X text 24 518 Version: 2009-01-11; +#X text 94 292 [tcpsocketserver <protocol> <port>]; +#X obj 13 14 declare -stdpath extra/mrpeach; +#X connect 0 0 13 0; +#X connect 5 0 18 0; +#X connect 6 0 18 0; +#X connect 7 0 6 0; +#X connect 8 0 5 0; +#X connect 9 0 18 0; +#X connect 10 0 9 0; +#X connect 13 0 15 0; +#X connect 13 1 8 0; +#X connect 13 2 7 0; +#X connect 13 3 10 0; +#X connect 14 0 16 0; +#X connect 15 0 17 0; +#X connect 16 0 1 0; +#X connect 16 1 2 0; +#X connect 16 2 3 0; +#X connect 16 3 4 0; +#X connect 17 0 18 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.