[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: quarks:[1288] DataNetwork



Revision: 1288
          http://quarks.svn.sourceforge.net/quarks/?rev=1288&view=rev
Author:   nescivi
Date:     2009-12-15 19:56:56 +0000 (Tue, 15 Dec 2009)

Log Message:
-----------
update of DataNetwork to version 0.5. This breaks compatibility with previous versions.

Modified Paths:
--------------
    DataNetwork/Help/SWDataNetworkClient.html
    DataNetwork/Help/doc/datanetwork.pdf
    DataNetwork/Help/doc/datanetwork.tex
    DataNetwork/SWDataNetworkClient.sc
    DataNetwork/SWDataNetworkClientGui.sc
    DataNetwork/SWDataNetworkOSC.sc

Modified: DataNetwork/Help/SWDataNetworkClient.html
===================================================================
--- DataNetwork/Help/SWDataNetworkClient.html	2009-12-15 16:53:42 UTC (rev 1287)
+++ DataNetwork/Help/SWDataNetworkClient.html	2009-12-15 19:56:56 UTC (rev 1288)
@@ -108,6 +108,8 @@
 
 <h4> - Sending query messages - </h4>
 
+<DT><STRONG>queryAll (  )</STRONG></DT>
+<DD>Execute all of the queries below.</DD>
 <DT><STRONG>queryExpected (  )</STRONG></DT>
 <DD>Query which nodes are expected in the network.</DD>
 <DT><STRONG>queryNodes (  )</STRONG></DT>

Modified: DataNetwork/Help/doc/datanetwork.pdf
===================================================================
(Binary files differ)

Modified: DataNetwork/Help/doc/datanetwork.tex
===================================================================
--- DataNetwork/Help/doc/datanetwork.tex	2009-12-15 16:53:42 UTC (rev 1287)
+++ DataNetwork/Help/doc/datanetwork.tex	2009-12-15 19:56:56 UTC (rev 1288)
@@ -60,64 +60,65 @@
 \verb|/datanetwork/quit| & si & host, port no. & inform that the host has quit \\
 
 \verb|/register| & is & port no., name & register to the network as a client, the name is used as an identifier for the client to remember settings \\
-\verb|/registered| & i & port no. & reply to register to the network as a client \\
+\verb|/registered| & i & port no., name & reply to register to the network as a client \\
 
-\verb|/unregister| & i & port no. & unregister to the network as a client \\  
-\verb|/unregistered| & i & port no. & reply to unregister to the network as a client \\
+\verb|/unregister| & is & port no., name & unregister to the network as a client \\  
+\verb|/unregistered| & is & port no., name & reply to unregister to the network as a client \\
 
-\verb|/ping| & i & port no. &  message to check if client is still there \\
-\verb|/pong| & i & port no. &  expected reply to the \verb|/ping| message \\
+\verb|/ping| & is & port no., name &  message to check if client is still there \\
+\verb|/pong| & is & port no., name &  expected reply to the \verb|/ping| message \\
 
 \verb|/error| & ssi & cause, error message, error ID & error occurred upon request (indicated by cause) \\
 \verb|/warn| & ssi & cause, warn message, error ID & non fatal error occurred upon request \\  
 
-\verb|/query/expected| & i & port no.& query which nodes are expected in the network (reply /info/expected) \\
-\verb|/query/nodes| & i & port no.& query which nodes are in the network (reply /info/node) \\
-\verb|/query/slots| & i & port no.& query which slots are in the network (reply /info/slot)\\
-\verb|/query/clients| & i & port no.& query which clients are in the network (reply /info/client)\\
-\verb|/query/setters| & i & port no.& query which nodes the client is the setter of (reply /info/setter) \\
-\verb|/query/subscriptions| & i & port no.& query which subscriptions the client has (reply /subscribed/node, /subscribed/slot)\\
+\verb|/query/all| & is & port no., name& do all queries \\
+\verb|/query/expected| & is & port no., name& query which nodes are expected in the network (reply /info/expected) \\
+\verb|/query/nodes| & is & port no., name& query which nodes are in the network (reply /info/node) \\
+\verb|/query/slots| & is & port no., name& query which slots are in the network (reply /info/slot)\\
+\verb|/query/clients| & is & port no., name& query which clients are in the network (reply /info/client)\\
+\verb|/query/setters| & is & port no., name& query which nodes the client is the setter of (reply /info/setter) \\
+\verb|/query/subscriptions| & is & port no., name& query which subscriptions the client has (reply /subscribed/node, /subscribed/slot)\\
 
 \verb|/info/expected| & i(s) & node ID, node label & info about an expected node \\
 \verb|/info/node| & isii & node ID, node label, number of slots, node type & info about a node \\
 \verb|/info/slot| & iisi & node ID, slot ID, slot label, slot type & info about a slot \\
-\verb|/info/client| & sis & ip, port no., hostname & info about a client \\
+\verb|/info/client| & sis & ip, port no., name & info about a client \\
 \verb|/info/setter| & isii & node ID, node label, number of slots, node type & info about a node the client is setting \\
 
-\verb|/subscribe/all| & i & port no. & subscribe to receive data from all nodes \\
-\verb|/unsubscribe/all| & i & port no. & unsubscribe from all nodes \\
+\verb|/subscribe/all| & is & port no., name & subscribe to receive data from all nodes \\
+\verb|/unsubscribe/all| & is & port no., name & unsubscribe from all nodes \\
 
-\verb|/subscribe/node| & ii & port no., node ID & subscribe to receive data from a node \\
-\verb|/subscribed/node| & ii & port no., node ID & reply to subscribe to receive data from a node \\
+\verb|/subscribe/node| & isi & port no., name, node ID & subscribe to receive data from a node \\
+\verb|/subscribed/node| & isi & port no., name, node ID & reply to subscribe to receive data from a node \\
 
-\verb|/unsubscribe/node| & ii & port no., node ID & unsubscribe to receive data from a node \\
-\verb|/unsubscribed/node| & ii & port no., node ID & reply to unsubscribe to receive data from a node \\
+\verb|/unsubscribe/node| & isi & port no., name, node ID & unsubscribe to receive data from a node \\
+\verb|/unsubscribed/node| & isi & port no., name, node ID & reply to unsubscribe to receive data from a node \\
 
-\verb|/subscribe/slot| & iii & port no., node ID, slot ID & subscribe to receive data from a slot \\  
-\verb|/subscribed/slot| & iii & port no., node ID, slot ID & reply to subscribe to receive data from a slot \\  
+\verb|/subscribe/slot| & isii & port no., name, node ID, slot ID & subscribe to receive data from a slot \\  
+\verb|/subscribed/slot| & isii & port no., name, node ID, slot ID & reply to subscribe to receive data from a slot \\  
 
-\verb|/unsubscribe/slot| & iii & port no., node ID, slot ID & subscribe to receive data from a slot \\  
-\verb|/unsubscribed/slot| & iii & port no., node ID, slot ID & reply to unsubscribe to receive data from a slot \\  
+\verb|/unsubscribe/slot| & isii & port no., name, node ID, slot ID & subscribe to receive data from a slot \\  
+\verb|/unsubscribed/slot| & isii & port no., name, node ID, slot ID & reply to unsubscribe to receive data from a slot \\  
 
 \verb|/data/node| & iff..f & node ID, data values & node data \\
 \verb|/data/node| & iss..s & node ID, string data values & node data \\
-\verb|/get/node| & ii & port no., node ID & get data from a node (reply /data/node) \\
+\verb|/get/node| & isi & port no., name, node ID & get data from a node (reply /data/node) \\
 
 \verb|/data/slot| & iif & node ID, slot ID, data value & slot data \\
 \verb|/data/slot| & iis & node ID, slot ID, string data value & slot data \\
-\verb|/get/slot| & iii & port no., node ID, slot ID & get data from a slot (reply /data/slot) \\
+\verb|/get/slot| & isii & port no., name, node ID, slot ID & get data from a slot (reply /data/slot) \\
 
-\verb|/set/data| & iif..f & port no., node ID, data values & set data to a node (reply /data/node)\\
-\verb|/set/data| & iis..s & port no., node ID, string data values & set data to a node\\
+\verb|/set/data| & isif..f & port no., name, node ID, data values & set data to a node (reply /data/node)\\
+\verb|/set/data| & isis..s & port no., name, node ID, string data values & set data to a node\\
 
-\verb|/label/node| & iis & port no., node ID, node label & set label to a node \\
-\verb|/label/slot| & iiis & port no., node ID, slot ID, slot label & set label to a slot \\
+\verb|/label/node| & isis & port no., name, node ID, node label & set label to a node \\
+\verb|/label/slot| & isiis & port no., name, node ID, slot ID, slot label & set label to a slot \\
 
-\verb|/remove/node| & ii & port no., node ID & remove a node (only possible if client is setter) \\
+\verb|/remove/node| & isi & port no., name, node ID & remove a node (only possible if client is setter) \\
 \verb|/removed/node| & i & node ID & reply to remove a node \\
-\verb|/remove/all| & i & port no. & remove all nodes the client is a setter of (generates /removed/node messages) \\
+\verb|/remove/all| & is & port no., name & remove all nodes the client is a setter of (generates /removed/node messages) \\
 
-\verb|/add/expected| & ii(isi) & port no., node ID, node size, node label, node type & add an expected node to the network (reply /info/expected) \\
+\verb|/add/expected| & isi(isi) & port no., name, node ID, node size, node label, node type & add an expected node to the network (reply /info/expected) \\
  &  &  & if node size is given, the node is created as well (and generates a /info/node message) \\
  &  &  & node type is 0: float, 1: string (default is 0) \\
 \hline
@@ -147,6 +148,8 @@
  12 & "Node with id"+...+"does not have"+..+"slots" \\
  12 & "Node with id"+...+"does not have"+..+"slots" \\
  13 & "Node with id"+...+"has wrong type"+... \\
+ 14 & "Client with IP"+addr.ip+"and port"+addr.port+"was not registered under name"+name \\
+ 15 & "Client with IP"+addr.ip+"and port"+addr.port+"and name" + name + "is not registered. Please register first" \\
  \hline
  \end{tabular}
 \end{center}
@@ -175,6 +178,7 @@
 
 Documentation for these is available in HTML format.
 
+
 \section{Installation}
 
 \subsection{SuperCollider Quark}
@@ -211,7 +215,13 @@
 
 // create a network client:
 y = SWDataNetworkClient.new( ~hostip, "myname" );
+// where ~hostip is an IP address of the datanetwork host like: "192.168.0.104",
+// and "myname" is the name by which you (as a client) will be identified in the network:
+// so it becomes:
+// y = SWDataNetworkClient.new( "192.168.0.104", "myname" );
 
+// to show a GUI:
+y.makeGui;
 

 // For more help, access the helpfile:
 SenseWorldDataNetwork
@@ -254,21 +264,142 @@
 %  \item (discard) change expectedNodes to become a security option
 % \end{itemize}
 
+\section{Detailed message description}
+
+\begin{itemize}
+ \item \verb|/datanetwork/announce| - si - host, port no. 
+    \begin{description}
+    \item[sent by host] When the host becomes active, or manual. It is sent both as a broadcast message to the network, and to any clients that may be known already by the host by their IPs.
+    \item[response] clients should note the possible change in port and reregister if not registered
+   \end{description}
+
+\item \verb|/datanetwork/quit| - si - host, port no.
+    \begin{description}
+    \item[sent by host] When the host shuts down (in a proper way, not when it crashes).
+    \item[response] clients should check if this is from their host, and note that they are no longer registered with the datanetwork
+   \end{description}
+
+\item \verb|/register| - is - port no., name
+    \begin{description}
+     \item[sent by client] In order to register
+     \item[response] If it is a new client, the host will register the client and reply with the \verb|/registered| message. If it is a client at the same IP, port and name that was already registered, the host will reply with \verb|/registered|. If a client with that IP and port, but with a different name was already registered, the host will return an error message 2.
+   \end{description}
+
+\item \verb|/registered| - is - port no., name
+    \begin{description}
+     \item[sent by host] Upon a succesful registration of the client
+     \item[response] The client should note that it has been registered with the host.
+   \end{description}
+
+\item \verb|/unregister| - is - port no., name
+    \begin{description}
+     \item[sent by client] In order to unregister
+     \item[response] If the client was registered under that port and name, the host will return the \verb|/unregistered| message. If the client name does not match, it will return error 14; if the client was not registered, the host returns error 3.
+   \end{description}
+
+\item \verb|/unregistered| - is - port no., name
+    \begin{description}
+     \item[sent by host] Upon a succesful unregistration of the client, or before a shutdown of the host, or when the maximum number of pings are left without reply.
+     \item[response] The client should note that it has been unregistered with the host.
+   \end{description}
+
+\item \verb|/ping| - is - port no., name
+    \begin{description}
+     \item[sent by host] Every second to check that the client is still there
+     \item[response] The client should send a \verb|/pong| message back, if it has indeed this name.
+   \end{description}
+
+\item \verb|/pong| - is - port no., name
+    \begin{description}
+     \item[sent by client] In response to the \verb|/ping| message of the host.
+     \item[response] none
+   \end{description}
+
+\item \verb|/error| - ssi - cause, error message, error ID
+    \begin{description}
+     \item[sent by host] when an error occurs. See the error message table for descriptions of errors.
+     \item[response] client could do attempts to fix the error.
+   \end{description}
+
+\item \verb|/warn| - ssi - cause, error message, error ID
+    \begin{description}
+     \item[sent by host] When a request from the client does not have any results. See the error message table for descriptions of warnings.
+     \item[response] client can display the warning to the user, but do not need to take action.
+   \end{description}
+
+
+% \verb|/query/all| & i & port no.& query which nodes are expected in the network (reply /info/expected) \\
+% \verb|/query/expected| & i & port no.& query which nodes are expected in the network (reply /info/expected) \\
+% \verb|/query/nodes|    & i & port no.& query which nodes are in the network (reply /info/node) \\
+% \verb|/query/slots|    & i & port no.& query which slots are in the network (reply /info/slot)\\
+% \verb|/query/clients|  & i & port no.& query which clients are in the network (reply /info/client)\\
+% \verb|/query/setters|  & i & port no.& query which nodes the client is the setter of (reply /info/setter) \\
+% \verb|/query/subscriptions| & i & port no.& query which subscriptions the client has (reply /subscribed/node, /subscribed/slot)\\
+% 
+% \verb|/info/expected| & i(s) & node ID, node label & info about an expected node \\
+% \verb|/info/node| & isii & node ID, node label, number of slots, node type & info about a node \\
+% \verb|/info/slot| & iisi & node ID, slot ID, slot label, slot type & info about a slot \\
+% \verb|/info/client| & sis & ip, port no., hostname & info about a client \\
+% \verb|/info/setter| & isii & node ID, node label, number of slots, node type & info about a node the client is setting \\
+% 
+% \verb|/subscribe/all| & i & port no. & subscribe to receive data from all nodes \\
+% \verb|/unsubscribe/all| & i & port no. & unsubscribe from all nodes \\
+% 
+% \verb|/subscribe/node| & ii & port no., node ID & subscribe to receive data from a node \\
+% \verb|/subscribed/node| & ii & port no., node ID & reply to subscribe to receive data from a node \\
+% 
+% \verb|/unsubscribe/node| & ii & port no., node ID & unsubscribe to receive data from a node \\
+% \verb|/unsubscribed/node| & ii & port no., node ID & reply to unsubscribe to receive data from a node \\
+% 
+% \verb|/subscribe/slot| & iii & port no., node ID, slot ID & subscribe to receive data from a slot \\  
+% \verb|/subscribed/slot| & iii & port no., node ID, slot ID & reply to subscribe to receive data from a slot \\  
+% 
+% \verb|/unsubscribe/slot| & iii & port no., node ID, slot ID & subscribe to receive data from a slot \\  
+% \verb|/unsubscribed/slot| & iii & port no., node ID, slot ID & reply to unsubscribe to receive data from a slot \\  
+% 
+% \verb|/data/node| & iff..f & node ID, data values & node data \\
+% \verb|/data/node| & iss..s & node ID, string data values & node data \\
+% \verb|/get/node| & ii & port no., node ID & get data from a node (reply /data/node) \\
+% 
+% \verb|/data/slot| & iif & node ID, slot ID, data value & slot data \\
+% \verb|/data/slot| & iis & node ID, slot ID, string data value & slot data \\
+% \verb|/get/slot| & iii & port no., node ID, slot ID & get data from a slot (reply /data/slot) \\
+% 
+% \verb|/set/data| & iif..f & port no., node ID, data values & set data to a node (reply /data/node)\\
+% \verb|/set/data| & iis..s & port no., node ID, string data values & set data to a node\\
+% 
+% \verb|/label/node| & iis & port no., node ID, node label & set label to a node \\
+% \verb|/label/slot| & iiis & port no., node ID, slot ID, slot label & set label to a slot \\
+% 
+% \verb|/remove/node| & ii & port no., node ID & remove a node (only possible if client is setter) \\
+% \verb|/removed/node| & i & node ID & reply to remove a node \\
+% \verb|/remove/all| & i & port no. & remove all nodes the client is a setter of (generates /removed/node messages) \\
+% 
+% \verb|/add/expected| & ii(isi) & port no., node ID, node size, node label, node type & add an expected node to the network (reply /info/expected) \\
+%  &  &  & if node size is given, the node is created as well (and generates a /info/node message) \\
+%  &  &  & node type is 0: float, 1: string (default is 0) \\
+ 
+\end{itemize}
+
+
 \section*{Acknowledgments}\label{sec:acknowledgments}
 This software was created by
 
 \textbf{SuperCollider classes, C++ client:}
 Marije Baalman (nescivi)  
 
-\textbf{Processing library:}
-Vincent de Belleval
+\textbf{Processing \& Java library:}
+Vincent de Belleval,
 Brett Bergmann
 
-\textbf{Max patches:}
-Harry Smoak, 
+\textbf{Max objects:}
+Harry Smoak,
 Joseph Malloch, 
 Brett Bergmann
 
+\textbf{PureData objects:}
+Joseph Malloch, 
+Joseph Thibodeau
 
 Developed as part of the "Sense/Stage" project and the "Papyrus" project between\\
 Design and Computation Arts, Fine Arts, Concordia University\\
@@ -285,6 +416,9 @@
 \subsection*{ChangeLog}
 
 \begin{itemize}
+ \item ------------- v 0.5 --------------
+ \item 12/12/2009 - all messages from clients need to have port no and client name. This breaks compatibility with previous versions.
+ 
  \item ------------- v 0.3 --------------
  \item 2/12/2009 - lots of bugfixes. New clients: processing and C++. Better assertion of argument types now in the sending of data by the host. 
  \item ------------- v 0.3 --------------

Modified: DataNetwork/SWDataNetworkClient.sc
===================================================================
--- DataNetwork/SWDataNetworkClient.sc	2009-12-15 16:53:42 UTC (rev 1287)
+++ DataNetwork/SWDataNetworkClient.sc	2009-12-15 19:56:56 UTC (rev 1288)
@@ -64,14 +64,15 @@
 			}),
 			OSCresponderNode( host, '/datanetwork/quit', { |t,r,msg,addr|
 				if ( verbose > 0, { msg.postln; });
-				this.lostHost;
+				// could do checking of hostname and port!
+				this.lostHost( *(msg.copyToEnd( 1 )) );
 			}),
 			OSCresponderNode( host, '/error', { |t,r,msg,addr|
-				"Error: ".post; msg.postln;
+				"DataNetwork Error: ".post; msg.postln;
 				if ( gui.notNil ){ gui.setInfo( msg )};
 			}),
 			OSCresponderNode( host, '/warn', { |t,r,msg,addr|
-				"Warning: ".post; msg.postln;
+				"DataNetwork Warning: ".post; msg.postln;
 				if ( gui.notNil ){ gui.setInfo( msg )};
 			}),
 			OSCresponderNode( host, '/ping', { |t,r,msg,addr|
@@ -188,7 +189,7 @@
 		}
 	}
 
-	lostHost{
+	lostHost{ |ip,port|
 		"DataNetwork host has quit".postln;
 		if ( gui.notNil ){ gui.setInfo( "DataNetwork host has quit" )};
 	}
@@ -215,7 +216,7 @@
 	// overloaded from base class
 	addExpected{ |id,label,size=nil,type=0,fromnw=false|
 		if ( fromnw.not, {
-			host.sendMsg( '/add/expected', NetAddr.langPort, id, size, label, type );
+			this.sendMsgWithArgs( '/add/expected', [ id, size, label, type] );
 		},{
 			// use the method from the super-class
 			super.addExpected( id, label, size, type );
@@ -265,8 +266,8 @@
 	// overloaded from base class
 	removeNode{ |id,fromnw=false|
 		if ( verbose > 0, { ("remove" + id).postln; });
-		if ( fromnw.not ){ 
-			host.sendMsg( '/remove/node', NetAddr.langPort, id.asInteger );
+		if ( fromnw.not ){
+			this.sendMsgWithArgs( '/remove/node', [ id.asInteger] );
 		}{
 			super.removeNode( id.asInteger );
 			//		nodes.removeAt( id.asInteger );			
@@ -276,100 +277,113 @@
 
 	/// OSC interface
 
+	sendSimpleMsg{ |msg|
+		host.sendMsg( msg, NetAddr.langPort, name.asString );
+	}
+
+	sendMsgWithArgs{ |msg,args|
+		var fullMsg = [ msg, NetAddr.langPort, name.asString ]++args;
+		host.sendMsg( *fullMsg );
+	}
+
 	register{
-		host.sendMsg( '/register', NetAddr.langPort, name );
+		this.sendSimpleMsg( '/register');
 	}
 
 	unregister{
-		host.sendMsg( '/unregister', NetAddr.langPort );
+		this.sendSimpleMsg( '/unregister');
 	}
 
 	// Querying ---
 
+	queryAll{
+		this.sendSimpleMsg( '/query/all' );
+	}
+
 	queryExpected{
-		host.sendMsg( '/query/expected', NetAddr.langPort );
+		this.sendSimpleMsg( '/query/expected' );
 	}
 
 	queryNodes{
-		host.sendMsg( '/query/nodes', NetAddr.langPort );
+		this.sendSimpleMsg( '/query/nodes' );
 	}
 
 	querySlots{
-		host.sendMsg( '/query/slots', NetAddr.langPort );
+		this.sendSimpleMsg( '/query/slots' );
 	}
 
 	querySetters{
-		host.sendMsg( '/query/setters', NetAddr.langPort );
+		this.sendSimpleMsg( '/query/setters' );
 	}
 
 	querySubscriptions{
-		host.sendMsg( '/query/subscriptions', NetAddr.langPort );
+		this.sendSimpleMsg( '/query/subscriptions' );
 	}
 
 	queryClients{
-		host.sendMsg( '/query/clients', NetAddr.langPort );
+		this.sendSimpleMsg( '/query/clients' );
 	}
 
 
 	// -- Subscribing --
 
 	subscribeAll{ 
-			host.sendMsg( '/subscribe/all', NetAddr.langPort );
+		this.sendSimpleMsg( '/subscribe/all' );
 	}
 
 	unsubscribeAll{ 
-			host.sendMsg( '/unsubscribe/all', NetAddr.langPort );
+		this.sendSimpleMsg( '/unsubscribe/all' );
 	}
 
 	removeAll{ 
-			host.sendMsg( '/remove/all', NetAddr.langPort );
+		this.sendSimpleMsg( '/remove/all' );
 	}
 
 	subscribeNode{ |node|
 		if ( node.isKindOf( SWDataNode ) ){
-			host.sendMsg( '/subscribe/node', NetAddr.langPort, node.id );
+			this.sendMsgWithArgs( '/subscribe/node', node.id );
 		}{
-			host.sendMsg( '/subscribe/node', NetAddr.langPort, node );
+			this.sendMsgWithArgs( '/subscribe/node', node );
 		}
 	}
 
 	unsubscribeNode{ |node|
 		if ( node.isKindOf( SWDataNode ) ){
-			host.sendMsg( '/unsubscribe/node', NetAddr.langPort, node.id );
+			this.sendMsgWithArgs( '/unsubscribe/node', node.id );
 		}{
-			host.sendMsg( '/unsubscribe/node', NetAddr.langPort, node );
+			this.sendMsgWithArgs( '/unsubscribe/node', node );
 		}
 	}
 
 	subscribeSlot{ |slot|
 		if ( slot.isKindOf( SWDataSlot ) ){
-			host.sendMsg( '/subscribe/slot', NetAddr.langPort, slot.id[0], slot.id[1] );
+			this.sendMsgWithArgs( '/subscribe/slot', slot.id );
 		}{
-			host.sendMsg( '/subscribe/slot', NetAddr.langPort, slot[0], slot[1] );
+			this.sendMsgWithArgs( '/subscribe/slot', slot );
 		}
 	}
 
 	unsubscribeSlot{ |slot|
 		if ( slot.isKindOf( SWDataSlot ) ){
-			host.sendMsg( '/unsubscribe/slot', NetAddr.langPort, slot.id[0], slot.id[1] );
+			this.sendMsgWithArgs( '/unsubscribe/slot', slot.id );
 		}{
-			host.sendMsg( '/unsubscribe/slot', NetAddr.langPort, slot[0], slot[1] );
+			this.sendMsgWithArgs( '/unsubscribe/slot', slot );
 		}
 	}
 
 	getNode{ |node|
 		if ( node.isKindOf( SWDataNode ) ){
-			host.sendMsg( '/get/node', NetAddr.langPort, node.id );
+			this.sendMsgWithArgs( '/get/node', node.id );
 		}{
-			host.sendMsg( '/get/node', NetAddr.langPort, node );
+			this.sendMsgWithArgs( '/get/node', node );
 		}
 	}
 
 	getSlot{ |slot|
 		if ( slot.isKindOf( SWDataSlot ) ){
-			host.sendMsg( '/get/slot', NetAddr.langPort, slot.id[0], slot.id[1] );
+			this.sendMsgWithArgs( '/get/slot', slot.id );
 		}{
-			host.sendMsg( '/get/slot', NetAddr.langPort, slot[0], slot[1] );
+			this.sendMsgWithArgs( '/get/node', slot );
 		}
 	}
 
@@ -448,22 +462,23 @@
 	// ---
 
 	labelNode{ |node|
-		host.sendMsg( '/label/node', NetAddr.langPort, node.id, node.key );
+		this.sendMsgWithArgs( '/label/node', [node.id, node.key] );
 	}
 
 	labelSlot{ |slot|
-		host.sendMsg( '/label/slot', NetAddr.langPort, slot.id[0], slot.id[1], slot.key );
+		this.sendMsgWithArgs( '/label/slot', slot.id ++ slot.key );
 	}
 
 	//-------------
 
 	sendData{ |id, data|
-		host.sendMsg( '/set/data', NetAddr.langPort, id, *data );
+		this.sendMsgWithArgs( '/set/data', [id] ++ data );
+		//	host.sendMsg( '/set/data', NetAddr.langPort, name.asString, id, *data );
 	}
 
 
 	sendPong{
-		host.sendMsg( '/pong', NetAddr.langPort );
+		this.sendSimpleMsg( '/pong' );
 		lasttime = Process.elapsedTime;
 	}
 

Modified: DataNetwork/SWDataNetworkClientGui.sc
===================================================================
--- DataNetwork/SWDataNetworkClientGui.sc	2009-12-15 16:53:42 UTC (rev 1287)
+++ DataNetwork/SWDataNetworkClientGui.sc	2009-12-15 19:56:56 UTC (rev 1288)
@@ -138,12 +138,7 @@
 		*/
 		GUI.button.new( w, Rect( 0, 0, bs, 16 )).states_(
 			[ [ "Query all", Color.blue ] ] ).action_( {
-				|but| 
-				network.queryExpected;
-				network.queryNodes;
-				network.querySlots;
-				network.querySetters;
-				network.querySubscriptions;
+				|but| network.queryAll;
 			}).font_( font );
 
 		GUI.button.new( w, Rect( 0, 0, bs, 16 )).states_(

Modified: DataNetwork/SWDataNetworkOSC.sc
===================================================================
--- DataNetwork/SWDataNetworkOSC.sc	2009-12-15 16:53:42 UTC (rev 1287)
+++ DataNetwork/SWDataNetworkOSC.sc	2009-12-15 19:56:56 UTC (rev 1288)
@@ -7,7 +7,7 @@
 
 	var <>verbose = 0;
 
-	var <>maxMissedPongs = 60;
+	var <>maxMissedPongs = 10;
 
 
 	var <clientDictionary;
@@ -58,7 +58,7 @@
 
 	stop{
 		clients.do{ |it| 
-			it.addr.sendMsg( '/unregistered', it.addr.port.asInteger );
+			it.addr.sendMsg( '/unregistered', it.addr.port.asInteger, it.key.asString );
 			it.addr.sendMsg( '/datanetwork/quit', myhost.hostname, myhost.port.asInteger );
 		};
 		this.logMsg("datanetwork stopped" );
@@ -67,7 +67,7 @@
 
 	sendPings{
 		clients.do{ |it| it.ping };
-		clients.do{ |it| if ( it.missedPongs > maxMissedPongs ){ this.removeClient( it.addr ) } };
+		clients.do{ |it| if ( it.missedPongs > maxMissedPongs ){ this.removeClient( it.addr, it.key ) } };
 	}
 
 	removeResponders{
@@ -86,7 +86,7 @@
 			OSCresponderNode( nil, '/unregister', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.removeClient( addr );
+					addr.port = msg[1]; this.removeClient( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 
@@ -95,47 +95,53 @@
 				if ( verbose > 3, { msg.postln; });
 				if ( msg.size > 1 ){
 					addr.port = msg[1];
-					client = this.findClient( addr );
+					client = this.findClient( addr, msg[2] );
 					if ( client.notNil, { client.pong } ) ;
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 
 			/// QUERIES
 
+			OSCresponderNode( nil, '/query/all', { |t,r,msg,addr|
+				if ( verbose > 1, { msg.postln; });
+				if ( msg.size > 1 ){
+					addr.port = msg[1]; this.allQuery( addr, msg[2] );
+				}{ if ( verbose > 0, { "missing port in message".postln; }); };
+			}),
 			OSCresponderNode( nil, '/query/expected', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.expectedQuery( addr );
+					addr.port = msg[1]; this.expectedQuery( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/query/nodes', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.nodeQuery( addr );
+					addr.port = msg[1]; this.nodeQuery( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/query/slots', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.slotQuery( addr );
+					addr.port = msg[1]; this.slotQuery( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/query/clients', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.clientQuery( addr );
+					addr.port = msg[1]; this.clientQuery( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/query/subscriptions', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.subscriptionQuery( addr );
+					addr.port = msg[1]; this.subscriptionQuery( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/query/setters', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.setterQuery( addr );
+					addr.port = msg[1]; this.setterQuery( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 
@@ -144,37 +150,37 @@
 			OSCresponderNode( nil, '/subscribe/all', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.allNodeSubscribe( addr );
+					addr.port = msg[1]; this.allNodeSubscribe( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/unsubscribe/all', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.allNodeUnsubscribe( addr );
+					addr.port = msg[1]; this.allNodeUnsubscribe( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/subscribe/node', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.nodeSubscribe( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.nodeSubscribe( addr, msg[2],  msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/unsubscribe/node', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.nodeUnsubscribe( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.nodeUnsubscribe( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/subscribe/slot', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.slotSubscribe( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.slotSubscribe( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/unsubscribe/slot', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.slotUnsubscribe( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.slotUnsubscribe( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 
@@ -183,35 +189,35 @@
 			OSCresponderNode( nil, '/add/expected', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.addExpected( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.addExpected( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			}),
 			OSCresponderNode( nil, '/set/data', { |t,r,msg,addr|
 				if ( verbose > 2, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.setData( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.setData( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			}),
 			OSCresponderNode( nil, '/label/slot', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.labelSlot( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.labelSlot( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };
 			}),
 			OSCresponderNode( nil, '/label/node', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.labelNode( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.labelNode( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			}),
 
 			/// GETTING
 			OSCresponderNode( nil, '/get/node', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.getNode( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.getNode( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			}),
 			OSCresponderNode( nil, '/get/slot', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.getSlot( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.getSlot( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			}),
 
 			/// REMOVING
@@ -219,12 +225,12 @@
 			OSCresponderNode( nil, '/remove/node', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.removeNode( addr, msg.copyToEnd( 2 ) );
+					addr.port = msg[1]; this.removeNode( addr, msg[2], msg.copyToEnd( 3 ) );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			}),
 			OSCresponderNode( nil, '/remove/all', { |t,r,msg,addr|
 				if ( verbose > 1, { msg.postln; });
 				if ( msg.size > 1 ){
-					addr.port = msg[1]; this.removeAll( addr );
+					addr.port = msg[1]; this.removeAll( addr, msg[2] );
 				}{ if ( verbose > 0, { "missing port in message".postln; }); };			})
 		];
 
@@ -388,76 +394,73 @@
 
 	///--------- subscriptions and data retrieval
 
-	allNodeSubscribe{ |addr|
+	allNodeSubscribe{ |addr,name|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/subscribe/all", 1 );
+			this.errorMsg( addr, "/subscribe/all", 15, [name] );
 		},{
 			network.nodes.do{ |it| 
 				client.subscribeNode( it.id );
-				this.getNode( addr, [it.id] );
+				this.getNode( addr, client.key, [it.id] );
 				this.logMsg( "client:"+(client.addr.asString.replace( "a NetAddr",""))+"subscribed to node:"+it.id );
 			};
 			this.logMsg( "/subscribe/all from client with IP"+addr.ip+"and port"+addr.port );
 		});
 	}
 
-	nodeSubscribe{ |addr,msg|
+	nodeSubscribe{ |addr,name,msg|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/subscribe/node", 1 );
+			this.errorMsg( addr, "/subscribe/node", 15, [name] );
 		},{
 			client.subscribeNode( msg[0].asInteger );
-			this.getNode( addr, msg );
+			this.getNode( addr, client.key,  msg );
 			this.logMsg( "client:"+(client.addr.asString.replace( "a NetAddr",""))+"subscribed to node:"+msg[0] );
 		});
 	}
 
-	slotSubscribe{ |addr,msg|
+	slotSubscribe{ |addr,name,msg|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/subscribe/slot", 1);
+			this.errorMsg( addr, "/subscribe/slot", 15, [name] );
 		},{
 			client.subscribeSlot( msg[0].asInteger, msg[1].asInteger );
-			this.getSlot( addr, msg );
+			this.getSlot( addr, client.key, msg );
 			this.logMsg( "client:"+(client.addr.asString.replace( "a NetAddr",""))+"subscribed to slot:"+msg.copyRange(0,1) );
 		});
 	}
 
 
-	allNodeUnsubscribe{ |addr|
+	allNodeUnsubscribe{ |addr,name|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/unsubscribe/all", 1);
+			this.errorMsg( addr, "/unsubscribe/all", 15, [name]);
 		},{
-			client.subscriptions.do{ |it| 
-				client.unsubscribeNode( it );
-				this.logMsg( "client:"+(client.addr.asString.replace( "a NetAddr",""))+"unsubscribed from node:"+it );
-			};
+			client.unsubscribeAll;
 			this.logMsg( "/unsubscribe/all from client with IP"+addr.ip+"and port"+addr.port );
 		});
 	}
 
-	nodeUnsubscribe{ |addr,msg|
+	nodeUnsubscribe{ |addr,name,msg|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/unsubscribe/node", 1);
+			this.errorMsg( addr, "/unsubscribe/node", 15, [name] );
 		},{
 			client.unsubscribeNode( msg[0].asInteger );
 			this.logMsg( "client:"+(client.addr.asString.replace( "a NetAddr",""))+"unsubscribed from node:"+msg[0] );
 		});
 	}
 
-	slotUnsubscribe{ |addr,msg|
+	slotUnsubscribe{ |addr,name,msg|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/unsubscribe/slot", 1);
+			this.errorMsg( addr, "/unsubscribe/slot", 15, name );
 		},{
 			client.unsubscribeSlot( msg[0].asInteger, msg[1].asInteger );
 			this.logMsg( "client:"+(client.addr.asString.replace( "a NetAddr",""))+"unsubscribed from slot:"+msg.copyRange(0,1) );
@@ -465,13 +468,13 @@
 	}
 
 
-	getNode{ |addr,msg|
+	getNode{ |addr,name,msg|
 		var client,data,node;
 		//[addr,msg].postln;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		//client.postln;
 		if ( client.isNil, {
-			this.errorMsg( addr, "/get/node", 1);
+			this.errorMsg( addr, "/get/node", 15, [name] );
 		},{
 			msg[0] = msg[0].asInteger;
 			node = network.nodes.at( msg[0] );
@@ -485,11 +488,11 @@
 		});
 	}
 
-	getSlot{ |addr,msg|
+	getSlot{ |addr,name,msg|
 		var client,node;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name.asSymbol );
 		if ( client.isNil, {
-			this.errorMsg( addr, "/get/slot", 1);
+			this.errorMsg( addr, "/get/slot", 15, [name]);
 		},{
 			msg[0] = msg[0].asInteger;
 			node = network.nodes.at( msg[0] );
@@ -504,8 +507,12 @@
 
 	// --------- client management -----------
 
-	findClient{ |addr|
-		^clients.select( { |it| it.addr == addr } ).first;
+	findClient{ |addr,name|
+		if ( name.notNil ){
+			^clients.select( { |it| (it.addr == addr) and: (it.key == name.asSymbol) } ).first;
+		}{ // don't check for name
+			^clients.select( { |it| it.addr == addr } ).first;
+		}
 	}
 
 	welcomeClientBack{ |client|
@@ -539,11 +546,10 @@
 			}{
 				if ( addr.port > 0){
 					clientPorts.add( addr.port );
-					newclient = SWDataNetworkOSCClient.new( addr );
+					newclient = SWDataNetworkOSCClient.new( addr, name.asSymbol );
 					clients = clients.add( newclient );
 					//	watcher.start;
 					clientDictionary.put( name.asSymbol, newclient );
-					newclient.key = name.asSymbol;
 					if ( gui.notNil ){ 
 						gui.addClient( newclient );
 					};
@@ -551,85 +557,127 @@
 				};
 			};
 		},{
-			this.errorMsg( addr, "/register", 2);
+			there = clientDictionary.at( name.asSymbol );
+			if ( there.notNil ){
+				this.welcomeClientBack( there );				
+				this.logMsg( "client reregistered:"+(addr.asString.replace( "a NetAddr",""))+name );				
+			}{
+				this.errorMsg( addr, "/register", 2);
+			};
 		});
 	}
 
-	removeClient{ |addr|
+	removeClient{ |addr,name|
 		var there,there2;
 		there = this.findClient( addr );
 		//		[addr,there].postln;
 
 		if ( there.notNil, { 
-			/// removed, as we keep the client in the dictionary
-			//	there.setters.do{ |node| setters.removeAt( node.id ) };
-			there.active = false;
-			clients.remove( there );
-			addr.sendMsg( '/unregistered', addr.port.asInteger );
+			if ( there.key == name.asSymbol ){
+				/// removed, as we keep the client in the dictionary
+				//	there.setters.do{ |node| setters.removeAt( node.id ) };
+				there.active = false;
+				clients.remove( there );
+				addr.sendMsg( '/unregistered', addr.port.asInteger, there.key );
+				if ( gui.notNil ){
+					gui.removeClient( there );
+				};
+				this.logMsg( "client unregistered:"+(addr.asString.replace( "a NetAddr","")) );
+			}{
+				this.errorMsg( addr, "/unregister", 14, [name] );
+				this.logMsg( "client tried to unregister:"+(addr.asString.replace( "a NetAddr",""))+"but was not succesful" );
+
+			};
 		},{
 			this.errorMsg( addr, "/unregister", 3 );
+				this.logMsg( "client tried to unregister:"+(addr.asString.replace( "a NetAddr",""))+"but was not succesful" );
 		} );
 
 		//		there2 = setters.findKeyForValue( addr );
 		//		if ( there2.notNil, { setters.removeAt( there2 ) } );
+	}
 
+	//------- Queries -------
 
-		if ( gui.notNil ){
-			gui.removeClient( there );
-		};
-		this.logMsg( "client unregistered:"+(addr.asString.replace( "a NetAddr","")) );
+	allQuery{ |addr,name|
+		this.logMsg( "/query/all from client with IP"+addr.ip+"and port"+addr.port );
+		this.expectedQuery( addr, name );
+		this.nodeQuery( addr, name );
+		this.slotQuery( addr, name );
+		this.clientQuery( addr, name );
+		this.subscriptionQuery( addr, name );
+		this.setterQuery( addr, name );
 	}
 
-	//------- Queries -------
-
-	expectedQuery{ |addr|
-		if ( network.expectedNodes.size == 0, {
-			this.warnMsg( addr, "/query/expected", 7 );
+	expectedQuery{ |addr,name|
+		var client;
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/query/expected", 15, [name] );
+		},{
+			if ( network.expectedNodes.size == 0, {
+				this.warnMsg( addr, "/query/expected", 7 );
+			});
+			network.expectedNodes.do{ |key|
+				addr.sendMsg( '/info/expected', key );
+			};
 		});
-		network.expectedNodes.do{ |key|
-			addr.sendMsg( '/info/expected', key );
-		};
 		this.logMsg( "/query/expected from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
-	nodeQuery{ |addr|
-		if ( network.nodes.size == 0, {
-			this.warnMsg( addr, "/query/nodes", 8 );
+	nodeQuery{ |addr,name|
+		var client;
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/query/nodes", 15, [name] );
+		},{
+			if ( network.nodes.size == 0, {
+				this.warnMsg( addr, "/query/nodes", 8 );
+			});
+			network.nodes.keysValuesDo{ |key,node|
+				addr.sendMsg( '/info/node', key, node.key.asString, node.slots.size, node.type );
+			};
 		});
-		network.nodes.keysValuesDo{ |key,node|
-			addr.sendMsg( '/info/node', key, node.key.asString, node.slots.size, node.type );
-		};
-
 		this.logMsg( "/query/nodes from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
-	slotQuery{ |addr|
-		if ( network.nodes.size == 0, {
-			this.warnMsg( addr, "/query/slots", 8 );
+	slotQuery{ |addr,name|
+		var client;
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/query/slots", 15, [name] );
+		},{
+			if ( network.nodes.size == 0, {
+				this.warnMsg( addr, "/query/slots", 8 );
+			});
+			network.nodes.keysValuesDo{ |key,node|
+				node.slots.do{ |it,i|
+					addr.sendMsg( '/info/slot', key, i, it.key.asString, it.type );
+				};
+			};
 		});
-		network.nodes.keysValuesDo{ |key,node|
-			node.slots.do{ |it,i|
-				addr.sendMsg( '/info/slot', key, i, it.key.asString, it.type );
-			};
-		};
-
 		this.logMsg( "/query/slots from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
-	clientQuery{ |addr|
-		if ( clients.size == 0, {
-			this.warnMsg( addr, "/query/clients", 9 );
+	clientQuery{ |addr,name|
+		var client;
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/query/clients", 15, [name] );
+		},{
+			if ( clients.size == 0, {
+				this.warnMsg( addr, "/query/clients", 9 );
+			});
+			clients.do{ |it|
+				addr.sendMsg( '/info/client', it.addr.ip, it.addr.port, it.key );
+			};
 		});
-		clients.do{ |it|
-			addr.sendMsg( '/info/client', it.addr.ip, it.addr.port, it.key );
-		};
-
 		this.logMsg( "/query/clients from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
-	subscriptionQuery{ |addr|
+	subscriptionQuery{ |addr,name|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name );
 		if ( client.isNil, {
 			this.errorMsg( addr, "/query/subscriptions", 1 );
 		},{
@@ -643,9 +691,9 @@
 		this.logMsg( "/query/subscriptions from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
-	setterQuery{ |addr|
+	setterQuery{ |addr,name|
 		var client;
-		client = this.findClient( addr );
+		client = this.findClient( addr, name );
 		if ( client.isNil, {
 			this.errorMsg( addr, "/query/setters", 1);
 		},{
@@ -661,12 +709,12 @@
 
 	/// -------- node control by clients --------
 
-	setData{ |addr,msg|
+	setData{ |addr,name,msg|
 		var there, addsetter, node, code;
 		addsetter = false;
-		there = this.findClient( addr );
+		there = this.findClient( addr, name.asSymbol );
 		if ( there.isNil, {
-			this.errorMsg( addr, "/set/data", 1);
+			this.errorMsg( addr, "/set/data", 15, [name] );
 		},{
 			// node id:
 			msg[0] = msg[0].asInteger;
@@ -689,7 +737,7 @@
 								// has to look up the newly created node:
 								there.addSetter( network.nodes.at( msg[0] ) );
 								// only send data back to sender first time the node is set, for confirmation:
-								this.getNode( addr, msg );
+								this.getNode( addr, there.key, msg );
 								this.logMsg( "client:"+(there.addr.asString.replace( "a NetAddr",""))+"became setter of node:"+msg[0] );
 							});
 					}{
@@ -719,11 +767,11 @@
 		});
 	}
 
-	removeAll{ |addr|
+	removeAll{ |addr,name|
 		var there;
-		there = this.findClient( addr );
+		there = this.findClient( addr, name.asSymbol );
 		if ( there.isNil, {
-			this.errorMsg( addr, "/remove/all", 1);
+			this.errorMsg( addr, "/remove/all", 15, [name]);
 		},{
 			there.setters.do{ |nd|
 				if ( network.nodes.at( nd.id ).notNil,
@@ -738,11 +786,11 @@
 		});
 	}
 
-	removeNode{ |addr,msg|
+	removeNode{ |addr,name,msg|
 		var there,node;
-		there = this.findClient( addr );
+		there = this.findClient( addr, name.asSymbol );
 		if ( there.isNil, {
-			this.errorMsg( addr, "/remove/node", 1);
+			this.errorMsg( addr, "/remove/node", 15, [name] );
 		},{
 			msg[0] = msg[0].asInteger;
 			node = network.nodes.at( msg[0] );
@@ -764,68 +812,87 @@
 	}
 
 
-	labelNode{ |addr,msg|
-		msg[0] = msg[0].asInteger;
-		if ( network.nodes.at( msg[0] ).isNil and: setters.at( msg[0] ).isNil,
-			{
-				setters.put( msg[0], addr );
+	/// TODO: why am I using a different tactic here??? Fix check for name!
+
+	labelNode{ |addr,name,msg|
+		var client;
+		// a client should be registered before being able to add expected nodes
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/label/node", 15, [name] );
+		},{
+			msg[0] = msg[0].asInteger;
+			if ( network.nodes.at( msg[0] ).isNil and: setters.at( msg[0] ).isNil,
+				{
+					setters.put( msg[0], addr );
+				});
+			if ( network.expectedNodes.indexOf( msg[0] ).isNil, {
+				this.warnMsg( addr, "/label/node", 6, msg );
+				if ( setters.at( msg[0] ) == addr, {
+					network.add( msg[1], msg[0] );
+				},{
+					this.warnMsg( addr, "/label/node", 4, msg );
+				});
 			});
-		if ( network.expectedNodes.indexOf( msg[0] ).isNil, {
-			this.warnMsg( addr, "/label/node", 6, msg );
-			if ( setters.at( msg[0] ) == addr, {
-				network.add( msg[1], msg[0] );
-			},{
-				this.warnMsg( addr, "/label/node", 4, msg );
-			});
 		});
 		this.logMsg(  "/label/node:" + msg[0] + " from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
-	labelSlot{ |addr,msg|
-		msg[0] = msg[0].asInteger;
-		if ( network.nodes.at( msg[0] ).isNil and: setters.at( msg[0] ).isNil,
-			{
-				setters.put( msg[0], addr );
+	labelSlot{ |addr,name,msg|
+		var client;
+		// a client should be registered before being able to add expected nodes
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/label/slot", 15, [name] );
+		},{
+			msg[0] = msg[0].asInteger;
+			if ( network.nodes.at( msg[0] ).isNil and: setters.at( msg[0] ).isNil,
+				{
+					setters.put( msg[0], addr );
+				});
+			if ( network.expectedNodes.indexOf( msg[0] ).isNil, {
+				this.errorMsg( addr, "/label/slot", 6, msg );
+			}, {
+				if ( setters.at( msg[0] ) == addr, {
+					network.add( msg[2], [msg[0], msg[1].asInteger] );
+				},{
+					this.warnMsg( addr, "/label/slot", 4, msg );
+				});
 			});
-		if ( network.expectedNodes.indexOf( msg[0] ).isNil, {
-			this.errorMsg( addr, "/label/slot", 6, msg );
-		}, {
-			if ( setters.at( msg[0] ) == addr, {
-				network.add( msg[2], [msg[0], msg[1].asInteger] );
-			},{
-				this.warnMsg( addr, "/label/slot", 4, msg );
-			});
 		});
 		this.logMsg( "/label/slot:" + msg.copyRange(0,1) + " from client with IP"+addr.ip+"and port"+addr.port );
 	}
 
 
-	addExpected{ |addr,msg|
+	addExpected{ |addr,name,msg|
 		var client;
-		msg[0] = msg[0].asInteger;
-		if ( msg[1].notNil ){
-			msg[1] = msg[1].asInteger;
-		};
-		if ( network.nodes.at( msg[0] ).isNil and: setters.at( msg[0] ).isNil,
-			{
-				setters.put( msg[0], addr );
-			});
-		if ( setters.at( msg[0] ) == addr, {
-			switch( msg.size,
-				4, { network.addExpected( msg[0], msg[2], msg[1], msg[3] ); },
-				3, { network.addExpected( msg[0], msg[2], msg[1] ); },
+		// a client should be registered before being able to add expected nodes
+		client = this.findClient( addr, name );
+		if ( client.isNil, {
+			this.errorMsg( addr, "/add/expected", 15, [name] );
+		},{
+			msg[0] = msg[0].asInteger;
+			if ( msg[1].notNil ){
+				msg[1] = msg[1].asInteger;
+			};
+			if ( network.nodes.at( msg[0] ).isNil and: setters.at( msg[0] ).isNil,
+				{
+					setters.put( msg[0], addr );
+				});
+			if ( setters.at( msg[0] ) == addr, {
+				switch( msg.size,
+					4, { network.addExpected( msg[0], msg[2], msg[1], msg[3] ); },
+					3, { network.addExpected( msg[0], msg[2], msg[1] ); },
 				2, { network.addExpected( msg[0], size: msg[1] ); }
-			);
-			if ( msg[1].notNil, {
-				client = this.findClient( addr );
-				if ( client.notNil ){
+				);
+				if ( msg[1].notNil, {
 					if ( network.nodes.at( msg[0] ).notNil){
 						client.addSetter( network.nodes.at( msg[0] ) );
 					};
-				};
-			})
-		},{
-			this.warnMsg( addr, "/add/expected", 4, msg );
+				})
+			},{
+				this.warnMsg( addr, "/add/expected", 4, msg );
+			});
 		});
 		this.logMsg("/add/expected:" + msg + " from client with IP"+addr.ip+"and port"+addr.port );
 	}
@@ -847,7 +914,9 @@
 			10, { string = "Client with IP"+addr.ip+"and port"+addr.port+"has no setters"},
 			11, { string = "Client with IP"+addr.ip+"and port"+addr.port+"has no subscriptions" },
 			12, { string = "Node with id"+msg[0]+"does not have"+(msg.size-1)+"slots" },
-			13, { string = "Node with id"+msg[0]+"has wrong type"+msg[3] }
+			13, { string = "Node with id"+msg[0]+"has wrong type"+msg[3] },
+			14, { string = "Client with IP"+addr.ip+"and port"+addr.port+"was not registered under name" + msg[0] },
+			15, { string = "Client with IP"+addr.ip+"and port"+addr.port+"and name" + msg[0] + "is not registered. Please register first" };
 		);	
 		^string;
 	}
@@ -910,12 +979,13 @@
 	var <slotNodesSubs;
 
 
-	*new{ |addr|
-		^super.new.init( addr );
+	*new{ |addr,name|
+		^super.new.init( addr,name );
 	}
 
-	init{ |address|
+	init{ |address,name|
 		addr = address;
+		key = name;
 
 		subscriptions = Set.new;
 
@@ -924,16 +994,16 @@
 		slotSubs = IdentityDictionary.new;
 
 		setters = Set.new;
-		addr.sendMsg( '/registered', addr.port.asInteger );
+		addr.sendMsg( '/registered', addr.port.asInteger, key.asString );
 	}
 
 	addr_{ |newaddr|
 		addr = newaddr;
-		addr.sendMsg( '/registered', addr.port.asInteger );
+		//	addr.sendMsg( '/registered', addr.port.asInteger );
 	}
 
 	ping{
-		addr.sendMsg( '/ping', addr.port.asInteger );
+		addr.sendMsg( '/ping', addr.port.asInteger, key.asString );
 		missedPongs = missedPongs + 1;
 	}
 
@@ -966,6 +1036,7 @@
 	}
 
 	welcomeBack{
+		addr.sendMsg( '/registered', addr.port.asInteger, key.asString );
 		this.pong;
 		this.setterQuery;		
 		this.subscriptionQuery;
@@ -985,11 +1056,11 @@
 		});
 
 		nodeSubs.do{ |it|
-			addr.sendMsg( '/subscribed/node', addr.port, it );
+			addr.sendMsg( '/subscribed/node', addr.port, key.asString, it );
 		};
 		slotNodesSubs.do{ |it|
 			slotSubs[it].do{ |jt|
-				addr.sendMsg( '/subscribed/slot', addr.port, it, jt );
+				addr.sendMsg( '/subscribed/slot', addr.port, key.asString, it, jt );
 			}
 		};
 		/*
@@ -1006,12 +1077,24 @@
 		^true;
 	}
 
+
+	unsubscribeAll{
+		nodeSubs.do{ |it|
+			this.unsubscribeNode( it );
+		};
+		slotNodesSubs.do{ |it|
+			slotSubs[it].do{ |jt|
+				this.unsubscribeSlot( it, jt );
+			}
+		};
+	}
+
 	subscribeNode{ |id|
 		subscriptions.add( id );
 
 		nodeSubs.add( id );
 
-		addr.sendMsg( '/subscribed/node', addr.port, id );
+		addr.sendMsg( '/subscribed/node', addr.port, key.asString, id );
 	}
 
 	subscribeSlot{ |id1,id2|
@@ -1023,13 +1106,13 @@
 		};
 		slotSubs[id1].add( id2 );
 
-		addr.sendMsg( '/subscribed/slot', addr.port, id1, id2 );
+		addr.sendMsg( '/subscribed/slot', addr.port, key.asString, id1, id2 );
 	}
 
 	unsubscribeNode{ |id|
 		subscriptions.remove( id );
 		nodeSubs.remove( id );
-		addr.sendMsg( '/unsubscribed/node', addr.port, id );
+		addr.sendMsg( '/unsubscribed/node', addr.port, key.asString, id );
 	}
 
 	unsubscribeSlot{ |id1,id2|
@@ -1042,7 +1125,7 @@
 			slotNodesSubs.remove( id1 );
 		};
 
-		addr.sendMsg( '/unsubscribed/slot', addr.port, id1, id2 );
+		addr.sendMsg( '/unsubscribed/slot', addr.port, key.asString, id1, id2 );
 	}
 
 	newExpected{ |id,label|


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/