Dear users and developers,
While testing running a remote server, the following three questions came into mind:
-
s.options.maxLogins = 4;
on remote servers is necessary to allow clients to connect to the machine. However, why are there no differences-
between
s.options.maxLogins = 4;
and
s.options.maxLogins = 3;
-
between
s.options.maxLogins = 5;
and
s.options.maxLogins = 8;
Should the number be one of Nth power of 2, i.e. 2, 4, 8, 16 and 32?
// on remote servers ( s.options.bindAddress = "0.0.0.0"; s.options.maxLogins = 4; // <- question 1 s.boot; )
-
-
Why do we need
serverOptions.maxLogins = 2;
in the code below on the client machines? It does not affect thes.options.maxLogins
on the connected server. I know that sclang returns an error ifserverOptions
(i.e.:ServerOption().maxLogins = 2
) is missed. However, what does the number indeed? There seems to be no difference if I write 1, 4 or 10 instead 2. -
The third question would be very foolish: Is it possible to assign, by evaluating a function, an interpreter variable from an argument? To use the connected remote server globally, I assigned the interpreter variables and in the following code block as follows:
l = ~connectRemote.("10.211.55.13", "lin")
I had tried to assign with the code~connectRemote.("10.211.55.13", "l")
, but could not achieve the goal even though having had variously combined.interpret
,compile
andthis.interpret(...)
. Would there be a sophisticated way to do it? I think the code below could be handy if there is a way to do it.
I really appreciate any help you can provide.
Best regards,
// on the client
(
~connectRemote = { |ip, serverName|
var serverOptions, condition, runResponder;
serverOptions = ServerOption();
serverOptions.maxLogins = 2; // <- question 2
serverName = Server.remote(serverName.asSymbol, NetAddr(ip, 57110), serverOptions); // <-question 3
fork{
condition = Condition{ serverName.serverRunning };
runResponder = SimpleController(serverName)
.put(\serverRunning, { condition.signal });
condition.wait;
runResponder.remove;
defer{
serverName.makeWindow;
serverName.meter };
CmdPeriod.add{
serverName.freeAll
}
};
serverName // <-question 3
}
)
l = ~connectRemote.("10.211.55.13", "lin") // <-question 3
l.class
w = ~connectRemote.("10.211.55.3", "win") // <-question 3
w.class
Server.all
Server.named
(
[l, w].do{|item|
SynthDef(\sineTest, { |out, freq| Out.ar(out, SinOsc.ar(freq, 0, 0.1)) }).send(item);
}
)
x = Synth(\sineTest, [out: 0, freq: 440 ], target: l)
y = Synth(\sineTest, [out: 1, freq: 550 ], target: w)
y.free
x.free
l.sendMsg("s_new", "sineTest", ~l = l.nextNodeID, 0, 1, "out", 0, "freq", 550);
l.sendMsg("/n_free", ~l);
w.sendMsg("s_new", "sineTest", ~w = l.nextNodeID, 0, 1, "out", 1, "freq", 1100);
w.sendMsg("/n_free", ~w);