From 08a6174a58cd6cb8cc33358feb2d813e44f36866 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 11 Apr 2006 02:29:04 +0000 Subject: added another basic to the series and a chat client/server which will be turned into an exercise svn path=/trunk/; revision=4872 --- doc/tutorials/networking/02.tcp_and_udp.pd | 31 +++++++++++++ doc/tutorials/networking/Attic/02.tcp_and_udp.pd | 31 +++++++++++++ doc/tutorials/networking/Attic/chat-client.pd | 59 ++++++++++++++++++++++++ doc/tutorials/networking/Attic/chat-server.pd | 14 ++++++ doc/tutorials/networking/TEMPLATE.pd | 20 +------- doc/tutorials/networking/chat-client.pd | 59 ++++++++++++++++++++++++ doc/tutorials/networking/chat-server.pd | 14 ++++++ 7 files changed, 209 insertions(+), 19 deletions(-) create mode 100644 doc/tutorials/networking/02.tcp_and_udp.pd create mode 100644 doc/tutorials/networking/Attic/02.tcp_and_udp.pd create mode 100644 doc/tutorials/networking/Attic/chat-client.pd create mode 100644 doc/tutorials/networking/Attic/chat-server.pd create mode 100644 doc/tutorials/networking/chat-client.pd create mode 100644 doc/tutorials/networking/chat-server.pd (limited to 'doc') diff --git a/doc/tutorials/networking/02.tcp_and_udp.pd b/doc/tutorials/networking/02.tcp_and_udp.pd new file mode 100644 index 00000000..514cf849 --- /dev/null +++ b/doc/tutorials/networking/02.tcp_and_udp.pd @@ -0,0 +1,31 @@ +#N canvas 185 93 644 464 10; +#X obj 511 62 import maxlib; +#X obj 10 10 cnv 15 400 40 empty empty tcp_and_udp 20 12 0 24 -228992 +-66577 0; +#X text 11 66 There are two main protocols for transmitting data over +networks: TCP and UDP.; +#X text 35 119 TCP is the most common \, it stands for Transmission +Control Protocol. Basically \, that means that the protocol manages +the transmission of the data. With TCP \, when you send a packet of +data \, its guaranteed to arrive.; +#X text 34 202 By default \, most networking objects in Pd use TCP: +; +#X obj 54 223 netsend; +#X obj 266 224 netclient; +#X obj 359 224 netserver; +#X text 178 295 UDP stands for User Datagram Protocol. It is a lightweight +\, simple protocol that is meant to be as quick and small as possible. +The downside is that the data packets are not guaranteed to arrive. +; +#X obj 35 180 pddp/pddplink http://en.wikipedia.org/wiki/Transmission_Control_Protocol +; +#X obj 177 355 pddp/pddplink http://en.wikipedia.org/wiki/User_Datagram_Protocol +; +#X obj 132 224 netreceive 32194; +#X obj 265 386 netreceive 32194 1; +#X obj 187 386 netsend 1; +#X obj 407 386 sendOSC; +#X obj 478 386 dumpOSC 32192; +#X text 180 409 One advantage to UDP is that you do not need to maintain +a connection to receive data. Whenever you open a UDP port \, you will +start receiving data.; diff --git a/doc/tutorials/networking/Attic/02.tcp_and_udp.pd b/doc/tutorials/networking/Attic/02.tcp_and_udp.pd new file mode 100644 index 00000000..514cf849 --- /dev/null +++ b/doc/tutorials/networking/Attic/02.tcp_and_udp.pd @@ -0,0 +1,31 @@ +#N canvas 185 93 644 464 10; +#X obj 511 62 import maxlib; +#X obj 10 10 cnv 15 400 40 empty empty tcp_and_udp 20 12 0 24 -228992 +-66577 0; +#X text 11 66 There are two main protocols for transmitting data over +networks: TCP and UDP.; +#X text 35 119 TCP is the most common \, it stands for Transmission +Control Protocol. Basically \, that means that the protocol manages +the transmission of the data. With TCP \, when you send a packet of +data \, its guaranteed to arrive.; +#X text 34 202 By default \, most networking objects in Pd use TCP: +; +#X obj 54 223 netsend; +#X obj 266 224 netclient; +#X obj 359 224 netserver; +#X text 178 295 UDP stands for User Datagram Protocol. It is a lightweight +\, simple protocol that is meant to be as quick and small as possible. +The downside is that the data packets are not guaranteed to arrive. +; +#X obj 35 180 pddp/pddplink http://en.wikipedia.org/wiki/Transmission_Control_Protocol +; +#X obj 177 355 pddp/pddplink http://en.wikipedia.org/wiki/User_Datagram_Protocol +; +#X obj 132 224 netreceive 32194; +#X obj 265 386 netreceive 32194 1; +#X obj 187 386 netsend 1; +#X obj 407 386 sendOSC; +#X obj 478 386 dumpOSC 32192; +#X text 180 409 One advantage to UDP is that you do not need to maintain +a connection to receive data. Whenever you open a UDP port \, you will +start receiving data.; diff --git a/doc/tutorials/networking/Attic/chat-client.pd b/doc/tutorials/networking/Attic/chat-client.pd new file mode 100644 index 00000000..d03eb75a --- /dev/null +++ b/doc/tutorials/networking/Attic/chat-client.pd @@ -0,0 +1,59 @@ +#N canvas 114 52 613 511 10; +#X obj 446 11 import maxlib cyclone; +#X msg 130 295 disconnect; +#X obj 108 323 netclient; +#X obj 50 233 prepend send; +#X obj 108 377 prepend set; +#X obj 60 377 print; +#X obj 27 66 trigger bang bang; +#X msg 27 88 clear; +#X text 314 266 <-- first connect to the server; +#X text 213 294 <-- disconnect when you are done to free the port; +#N canvas 238 612 454 304 /SUBPATCH/ 0; +#X obj 101 10 inlet; +#X obj 100 100 tgl 25 0 empty \$0-tgl connected 0 -6 0 8 -4033 -262144 +-1 1 1; +#X obj 121 35 select 1; +#X obj 199 245 s \$0-tgl; +#X msg 224 197 label \$1; +#X obj 224 173 symbol; +#X msg 220 133 connected; +#X msg 298 132 -; +#X msg 112 197 color \$1 \$2 \$3; +#X msg 158 165 1 1 0; +#X msg 71 165 -65281 0 -1; +#X obj 171 55 bang; +#X connect 0 0 1 0; +#X connect 0 0 2 0; +#X connect 2 0 10 0; +#X connect 2 0 6 0; +#X connect 2 1 11 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X connect 6 0 5 0; +#X connect 7 0 5 0; +#X connect 8 0 3 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 7 0; +#X coords 0 -1 1 1 25 25 1 100 100; +#X restore 181 345 pd; +#X msg 108 266 connect pdbox.at.or.at 50505; +#X msg 27 27 send; +#X obj 108 398 entry 300 100 grey90 black; +#X obj 49 121 entry 300 100 grey90 black; +#X text 114 96 type your message in the box below \, and click send +above; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 2 0 5 0; +#X connect 2 1 10 0; +#X connect 3 0 2 0; +#X connect 4 0 13 0; +#X connect 6 0 7 0; +#X connect 6 1 14 0; +#X connect 7 0 14 0; +#X connect 11 0 2 0; +#X connect 12 0 6 0; +#X connect 14 0 3 0; diff --git a/doc/tutorials/networking/Attic/chat-server.pd b/doc/tutorials/networking/Attic/chat-server.pd new file mode 100644 index 00000000..12cd8115 --- /dev/null +++ b/doc/tutorials/networking/Attic/chat-server.pd @@ -0,0 +1,14 @@ +#N canvas 769 55 458 308 10; +#X obj 258 13 import maxlib cyclone zexy; +#X obj 141 112 netserver 50505; +#X obj 68 83 prepend broadcast; +#X obj 153 204 prepend; +#X obj 197 176 makesymbol client%s_%s; +#X obj 197 151 pack float symbol; +#X connect 1 0 3 0; +#X connect 1 2 5 0; +#X connect 1 3 5 1; +#X connect 2 0 1 0; +#X connect 3 0 2 0; +#X connect 4 0 3 1; +#X connect 5 0 4 0; diff --git a/doc/tutorials/networking/TEMPLATE.pd b/doc/tutorials/networking/TEMPLATE.pd index 67cfc98c..35377e56 100644 --- a/doc/tutorials/networking/TEMPLATE.pd +++ b/doc/tutorials/networking/TEMPLATE.pd @@ -1,21 +1,3 @@ -#N canvas 15 58 632 452 10; +#N canvas 15 58 636 456 10; #X obj 8 10 cnv 15 400 40 empty empty TEMPLATE 20 12 0 24 -228992 -66577 0; -#X obj 56 151 send \$0-local-data; -#X obj 56 192 receive \$0-local-data; -#X obj 60 124 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 3700 1; -#X obj 59 221 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 3700 1; -#X obj 342 124 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 341 221 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 0 1; -#X obj 338 192 netreceive; -#X obj 338 151 netsend; -#X text 45 78 At the most basic level \, networking in Pd works like -the standard [send] and [receive] objects:; -#X connect 2 0 4 0; -#X connect 3 0 1 0; -#X connect 5 0 8 0; -#X connect 7 0 6 0; diff --git a/doc/tutorials/networking/chat-client.pd b/doc/tutorials/networking/chat-client.pd new file mode 100644 index 00000000..d03eb75a --- /dev/null +++ b/doc/tutorials/networking/chat-client.pd @@ -0,0 +1,59 @@ +#N canvas 114 52 613 511 10; +#X obj 446 11 import maxlib cyclone; +#X msg 130 295 disconnect; +#X obj 108 323 netclient; +#X obj 50 233 prepend send; +#X obj 108 377 prepend set; +#X obj 60 377 print; +#X obj 27 66 trigger bang bang; +#X msg 27 88 clear; +#X text 314 266 <-- first connect to the server; +#X text 213 294 <-- disconnect when you are done to free the port; +#N canvas 238 612 454 304 /SUBPATCH/ 0; +#X obj 101 10 inlet; +#X obj 100 100 tgl 25 0 empty \$0-tgl connected 0 -6 0 8 -4033 -262144 +-1 1 1; +#X obj 121 35 select 1; +#X obj 199 245 s \$0-tgl; +#X msg 224 197 label \$1; +#X obj 224 173 symbol; +#X msg 220 133 connected; +#X msg 298 132 -; +#X msg 112 197 color \$1 \$2 \$3; +#X msg 158 165 1 1 0; +#X msg 71 165 -65281 0 -1; +#X obj 171 55 bang; +#X connect 0 0 1 0; +#X connect 0 0 2 0; +#X connect 2 0 10 0; +#X connect 2 0 6 0; +#X connect 2 1 11 0; +#X connect 4 0 3 0; +#X connect 5 0 4 0; +#X connect 6 0 5 0; +#X connect 7 0 5 0; +#X connect 8 0 3 0; +#X connect 9 0 8 0; +#X connect 10 0 8 0; +#X connect 11 0 9 0; +#X connect 11 0 7 0; +#X coords 0 -1 1 1 25 25 1 100 100; +#X restore 181 345 pd; +#X msg 108 266 connect pdbox.at.or.at 50505; +#X msg 27 27 send; +#X obj 108 398 entry 300 100 grey90 black; +#X obj 49 121 entry 300 100 grey90 black; +#X text 114 96 type your message in the box below \, and click send +above; +#X connect 1 0 2 0; +#X connect 2 0 4 0; +#X connect 2 0 5 0; +#X connect 2 1 10 0; +#X connect 3 0 2 0; +#X connect 4 0 13 0; +#X connect 6 0 7 0; +#X connect 6 1 14 0; +#X connect 7 0 14 0; +#X connect 11 0 2 0; +#X connect 12 0 6 0; +#X connect 14 0 3 0; diff --git a/doc/tutorials/networking/chat-server.pd b/doc/tutorials/networking/chat-server.pd new file mode 100644 index 00000000..12cd8115 --- /dev/null +++ b/doc/tutorials/networking/chat-server.pd @@ -0,0 +1,14 @@ +#N canvas 769 55 458 308 10; +#X obj 258 13 import maxlib cyclone zexy; +#X obj 141 112 netserver 50505; +#X obj 68 83 prepend broadcast; +#X obj 153 204 prepend; +#X obj 197 176 makesymbol client%s_%s; +#X obj 197 151 pack float symbol; +#X connect 1 0 3 0; +#X connect 1 2 5 0; +#X connect 1 3 5 1; +#X connect 2 0 1 0; +#X connect 3 0 2 0; +#X connect 4 0 3 1; +#X connect 5 0 4 0; -- cgit v1.2.1