Update of /cvsroot/pure-data/doc/tutorials/networking In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16710
Added Files: 01.network_ports.pd 02.netsend_netreceive.pd 03.tcp_and_udp.pd 04.netserver_and_netclient.pd 05.OSC.pd TODO Removed Files: 01.netsend_netreceive.pd 02.tcp_and_udp.pd Log Message: first sketch on net intro
--- NEW FILE: 05.OSC.pd --- #N canvas 115 56 644 464 10; #X obj 8 10 cnv 15 400 40 empty empty OSC 20 12 0 24 -228992 -66577 0; #X obj 80 298 sendOSC; #X floatatom 79 323 5 0 0 0 - - -; #X msg 113 271 disconnect; #X floatatom 123 322 5 0 0 0 - - -; #X msg 21 164 send /kuva $1; #X floatatom 22 149 5 0 0 0 - - -; #X floatatom 122 148 5 0 0 0 - - -; #X floatatom 342 295 5 0 0 0 - - -; #X obj 338 312 print kuva; #X msg 122 164 send /space $1; #X obj 340 231 dumpOSC 30200; #X msg 109 249 connect localhost 30200; #X floatatom 231 147 5 0 0 0 - - -; #X msg 231 163 send /asdf $1; #X obj 339 259 OSCroute /kuva /space; #X obj 414 312 print space; #X obj 498 312 print other; #X floatatom 421 295 5 0 0 0 - - -; #X text 10 65 OSC is a protocol for sharing data across networks and applications. OSC stands for Open Sound Control. It was originally designed to replace MIDI , but it has caught on instead for inter-application communication.; #X text 21 361 On the most basic level , it works very similarly to [netsend] and [netreceive].; #X connect 1 0 2 0; #X connect 1 1 4 0; #X connect 3 0 1 0; #X connect 5 0 1 0; #X connect 6 0 5 0; #X connect 7 0 10 0; #X connect 10 0 1 0; #X connect 11 0 15 0; #X connect 12 0 1 0; #X connect 13 0 14 0; #X connect 14 0 1 0; #X connect 15 0 8 0; #X connect 15 0 9 0; #X connect 15 1 16 0; #X connect 15 1 18 0; #X connect 15 2 17 0;
--- NEW FILE: 01.network_ports.pd --- #N canvas 16 37 648 468 10; #X obj 8 10 cnv 15 400 40 empty empty network_ports 20 12 0 24 -228992 -66577 0; #X obj 49 418 pddp/pddplink http://en.wikipedia.org/wiki/TCP_and_UDP_port ; #X text 10 63 In computer speak , a "port" is an interface thru which data is sent and received. Network ports are numbered , and can be 1-65535. Network services are usually registered to use a specific network port. HTTP uses port 80 , sending email uses port 25 , IMAP uses port 143; #X text 10 140 Before using a network port for your application , you should check to make sure that it isn't already used. You can see a list of registered ports in a file called "services". On UNIX-based systems , its located in /etc/services. On Windows , its located in C:/WINDOWS/system32/drivers/etc/services; #X text 10 231 On UNIX-based systems , ports 0-1024 can only be used by the administrator account "root". Windows does not have this restriction. Most of the ports below 1024 are claimed anyway , so its best to use port numbers higher than 1024; #X text 9 331 root-only; #X text 101 330 often used; #X text 255 330 mostly available; #X text 6 348 0.......1024............10000..........................65535 ;
--- NEW FILE: 04.netserver_and_netclient.pd --- #N canvas 15 58 644 464 10; #X obj 8 10 cnv 15 400 40 empty empty netserver_and_netclient 20 12 0 24 -228992 -66577 0; #X floatatom 61 243 5 0 0 0 - - -; #X floatatom 91 224 5 0 0 0 - - -; #X symbolatom 165 178 10 0 0 0 - - -; #X floatatom 122 201 5 0 0 0 - - -; #X text 160 203 socket number; #X obj 125 375 netclient; #X msg 164 344 disconnect; #X floatatom 184 397 5 0 0 0 - - -; #X msg 141 296 send $1; #X obj 338 373 netclient; #X msg 355 343 disconnect; #X floatatom 395 394 5 0 0 0 - - -; #X msg 338 303 send $1; #X obj 338 419 print client2; #X floatatom 140 278 5 0 0 0 - - -; #X floatatom 337 285 5 0 0 0 - - -; #X obj 61 177 netserver 3001; #X msg 124 323 connect localhost 3001; #X msg 307 324 connect localhost 3001; #X msg 62 144 broadcast hello kuva!; #X text 99 244 data; #X text 133 225 connections; #X text 164 163 IP address; #X obj 125 419 print client1; #X text 302 162 netserver connects; #X text 301 174 different clients over; #X text 301 188 a network , broadcasting; #X text 301 200 stream of information; #X text 300 211 through a server; #X text 13 71 [netserver] and [netclient] gives you a bi-directional connection so you can send data back and forth thru it. Also , [netserver] helps you manage multiple connections.; #X connect 6 0 24 0; #X connect 6 1 8 0; #X connect 7 0 6 0; #X connect 9 0 6 0; #X connect 10 0 14 0; #X connect 10 1 12 0; #X connect 11 0 10 0; #X connect 13 0 10 0; #X connect 15 0 9 0; #X connect 16 0 13 0; #X connect 17 0 1 0; #X connect 17 1 2 0; #X connect 17 2 4 0; #X connect 17 3 3 0; #X connect 18 0 6 0; #X connect 19 0 10 0; #X connect 20 0 17 0;
--- 01.netsend_netreceive.pd DELETED ---
--- NEW FILE: 02.netsend_netreceive.pd --- #N canvas 15 58 636 456 10; #X obj 8 10 cnv 15 400 40 empty empty netsend_netreceive 20 12 0 24 -228992 -66577 0; #X obj 56 211 send $0-local-data; #X obj 56 342 receive $0-local-data; #X obj 60 174 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -225271 -1 -1 0 1; #X obj 59 381 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 311 174 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -225280 -1 -1 0 1; #X obj 311 381 hsl 150 20 0 127 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 308 261 netsend; #X obj 308 341 netreceive 34567; #X msg 326 222 connect localhost 34567; #X obj 308 280 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X obj 415 360 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1; #X text 329 279 <-- connection status; #X text 433 360 <-- connection status; #X msg 327 241 disconnect; #X msg 308 199 send $1; #X text 45 78 At the most basic level , networking in Pd works a lot like the standard [send] and [receive] objects , except there is a network port number rather than a send/receive name:; #X connect 2 0 4 0; #X connect 3 0 1 0; #X connect 5 0 15 0; #X connect 7 0 10 0; #X connect 8 0 6 0; #X connect 8 1 11 0; #X connect 9 0 7 0; #X connect 14 0 7 0; #X connect 15 0 7 0;
--- 02.tcp_and_udp.pd DELETED ---
--- NEW FILE: TODO ---
Topics to Add -------------
- netsend/netreceive - tcp and udp - netclient/netserver
- chat client/server exercise
- OSC
- running Pd as a daemon
- netpd
--- NEW FILE: 03.tcp_and_udp.pd --- #N canvas 185 93 648 468 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 285 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 345 pddp/pddplink http://en.wikipedia.org/wiki/User_Datagram_Protocol ; #X obj 132 224 netreceive 32194; #X obj 265 376 netreceive 32194 1; #X obj 187 376 netsend 1; #X obj 407 376 sendOSC; #X obj 478 376 dumpOSC 32192; #X text 180 399 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.;