seems like mrpeach is not fully included in pd-extended or at least [str] is missing. is this an abstraction or a library? marius.
Martin Peach wrote:
Here's my unfinished attempt at a web server. It will send a file "index.html" to a browser. It uses the string patch to pd and the str object, which can handle ascii without pd interpreting it along the way. It may be possible to do it using other objects. The main problem is the detection of special characters like CRLF in the request. The content-length field is not necessary if you close the connection after sending the data, so you don't need to know how long the data is going to be before you start. I think I have done that in a later version that I can't find right now...Obviously the index.html file could also be generated by pd, and then it would all be more interesting.
Martin
#N canvas 539 0 727 919 10; #X obj 104 61 mrpeach/tcpserver 80; #X floatatom 171 237 5 0 0 0 - - -; #X floatatom 286 191 5 0 0 0 - - -; #X obj 324 138 unpack 0 0 0 0; #X floatatom 324 161 3 0 0 0 - - -; #X floatatom 359 161 3 0 0 0 - - -; #X floatatom 395 161 3 0 0 0 - - -; #X floatatom 431 161 3 0 0 0 - - -; #X text 281 160 from; #X text 224 236 connections; #X text 199 191 on socket; #X obj 15 240 mrpeach/str to_symbol; #X obj 15 218 mrpeach/str csplit 32; #X obj 15 265 mrpeach/str compare GET; #X obj 22 282 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 168 260 mrpeach/str csplit 32; #X obj 168 294 mrpeach/str compare /; #X obj 175 311 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 153 339 &&; #X obj 160 356 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 1; #X obj 153 371 sel 1; #X obj 219 343 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 115 20 client 1 c:/martin/pd_patches/index.html; #X obj 201 399 mrpeach/str to_list Content-Length: 32 53 48 13 10 13 10; #X obj 153 439 prepend 464; #X obj 28 705 mrpeach/str to_symbol; #X obj 161 705 mrpeach/str to_symbol; #X obj 293 705 mrpeach/str to_symbol; #X obj 426 705 mrpeach/str to_symbol; #X obj 28 726 print a; #X obj 161 725 print b; #X obj 28 682 mrpeach/str csplit 10; #X obj 161 683 mrpeach/str csplit 10; #X obj 293 683 mrpeach/str csplit 10; #X obj 426 683 mrpeach/str csplit 10; #X obj 293 726 print c; #X obj 426 726 print d; #X obj 27 776 mrpeach/str to_symbol; #X obj 160 776 mrpeach/str to_symbol; #X obj 292 776 mrpeach/str to_symbol; #X obj 425 776 mrpeach/str to_symbol; #X obj 27 753 mrpeach/str csplit 10; #X obj 160 754 mrpeach/str csplit 10; #X obj 292 754 mrpeach/str csplit 10; #X obj 425 754 mrpeach/str csplit 10; #X obj 27 797 print e; #X obj 160 796 print f; #X obj 292 797 print g; #X obj 425 797 print h; #X obj 26 843 mrpeach/str to_symbol; #X obj 159 843 mrpeach/str to_symbol; #X obj 291 843 mrpeach/str to_symbol; #X obj 424 843 mrpeach/str to_symbol; #X obj 26 820 mrpeach/str csplit 10; #X obj 159 821 mrpeach/str csplit 10; #X obj 291 821 mrpeach/str csplit 10; #X obj 424 821 mrpeach/str csplit 10; #X obj 26 864 print i; #X obj 159 863 print j; #X obj 291 864 print k; #X obj 424 864 print l; #X obj 366 373 prepend 388; #X obj 378 312 mrpeach/str to_list HTTP/1.1 32 50 48 48 32 OK 13 10 Content-Length: 32 50 49 56 13 10 13 10; #X obj 400 254 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 -1; #X msg 510 33 disconnectsocket $1; #X msg 407 60 disconnectclient $1; #X floatatom 429 -8 5 0 0 0 - - -; #X obj 407 11 f; #X obj 407 -8 bng 15 250 50 0 empty empty empty 17 7 0 10 -258699 -241291 -1; #X floatatom 532 -8 5 0 0 0 - - -; #X obj 510 11 f; #X obj 510 -8 bng 15 250 50 0 empty empty empty 17 7 0 10 -258699 -241291 -1; #X text 378 -27 disconnect by socket or client number; #X msg 352 212 set $1; #X obj 321 446 t b b b; #X obj 360 468 f; #X obj 393 468 + 1; #X obj 360 488 i; #X obj 360 508 mrpeach/str to_list; #X obj 360 530 print count; #X floatatom 308 529 5 0 0 0 - - -; #X connect 0 0 12 0; #X connect 0 0 31 0; #X connect 0 1 1 0; #X connect 0 2 2 0; #X connect 0 2 73 0; #X connect 0 2 69 0; #X connect 0 3 3 0; #X connect 3 0 4 0; #X connect 3 1 5 0; #X connect 3 2 6 0; #X connect 3 3 7 0; #X connect 11 0 13 0; #X connect 12 0 11 0; #X connect 12 1 15 0; #X connect 13 0 14 0; #X connect 13 0 18 0; #X connect 15 0 16 0; #X connect 16 0 18 1; #X connect 16 0 17 0; #X connect 18 0 19 0; #X connect 18 0 20 0; #X connect 20 0 74 0; #X connect 21 0 23 0; #X connect 22 0 0 0; #X connect 23 0 24 0; #X connect 24 0 0 0; #X connect 25 0 29 0; #X connect 26 0 30 0; #X connect 27 0 35 0; #X connect 28 0 36 0; #X connect 31 0 25 0; #X connect 31 1 32 0; #X connect 32 0 26 0; #X connect 32 1 33 0; #X connect 33 0 27 0; #X connect 33 1 34 0; #X connect 34 0 28 0; #X connect 34 1 41 0; #X connect 37 0 45 0; #X connect 38 0 46 0; #X connect 39 0 47 0; #X connect 40 0 48 0; #X connect 41 0 37 0; #X connect 41 1 42 0; #X connect 42 0 38 0; #X connect 42 1 43 0; #X connect 43 0 39 0; #X connect 43 1 44 0; #X connect 44 0 40 0; #X connect 44 1 53 0; #X connect 49 0 57 0; #X connect 50 0 58 0; #X connect 51 0 59 0; #X connect 52 0 60 0; #X connect 53 0 49 0; #X connect 53 1 54 0; #X connect 54 0 50 0; #X connect 54 1 55 0; #X connect 55 0 51 0; #X connect 55 1 56 0; #X connect 56 0 52 0; #X connect 61 0 0 0; #X connect 62 0 61 0; #X connect 63 0 62 0; #X connect 64 0 0 0; #X connect 65 0 0 0; #X connect 66 0 67 1; #X connect 67 0 65 0; #X connect 68 0 67 0; #X connect 69 0 70 1; #X connect 70 0 64 0; #X connect 71 0 70 0; #X connect 73 0 61 0; #X connect 74 0 22 0; #X connect 74 1 62 0; #X connect 74 2 75 0; #X connect 75 0 76 0; #X connect 75 0 77 0; #X connect 76 0 75 1; #X connect 77 0 78 0; #X connect 77 0 80 0; #X connect 78 0 79 0;
PD-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list