2 summary:: network address
3 related:: Classes/OSCFunc
4 categories:: Control, OpenSoundControl
11 create new net address.
12 note::To send messages internally, loopback IP is used: "127.0.0.1"::
15 a link::Classes/String::, either an IP number (e.g. "192.168.34.56") or a hostname such as "otherHost.local".
18 a port number, like 57110.
21 create new net address using an integer IP number.
24 Get the port sclang is currently listening on (may change after a recompile).
27 Get a NetAddr which corresponds to localhost and the port sclang is listening on.
30 close all TCP connections.
33 Get or set the broadcast flag (whether or not broadcast messages can be sent).
37 private::prConnect, prDisconnect, prConnectionClosed, recover
40 send a message without timestamp to the addr.
43 send a bundle with timestamp to the addr.
46 send a raw message without timestamp to the addr.
51 argument::disconnectHandler
52 called when the connection is closed (either by the client or by the server).
58 returns the ip number (as a link::Classes/String::).
60 n = NetAddr("localhost", 57110);
67 n = NetAddr("127.0.0.1", 57120); // 57120 is sclang default port
68 r = OSCFunc({ arg msg, time; [time, msg].postln }, '/good/news', n);
70 n.sendMsg("/good/news", "you", "not you");
71 n.sendMsg("/good/news", 1, 1.3, 77);
74 n.sendBundle(0.2, ["/good/news", 1, 1.3, 77]);
79 // note that different NetAddr objects with the same port and ip are independent.
81 r = OSCFunc({ "message arrived".postln }, '/x');
83 n = NetAddr("127.0.0.1", 57120);
87 u = NetAddr("127.0.0.1", 57120);