5 import stereo
.dnssd
.DNSSDProvider
.Service
;
7 import com
.apple
.dnssd
.DNSSDException
;
11 public static void main(String args
[]) throws InterruptedException
, DNSSDException
{
16 for (int i
= 0; i
< args
.length
; i
++) {
17 if (args
[i
].equals("--host") || args
[i
].equals("-h")) {
18 if (i
+1 < args
.length
) {
23 else if (args
[i
].equals("--port") || args
[i
].equals("-p")) {
24 if (i
+1 < args
.length
) {
25 port
= Integer
.parseInt(args
[i
+1]);
32 System
.out
.println("Available stereo servers:");
34 Set
<Service
> services
= stereo
.dnssd
.DNSSD
.impl().browse("_touch-able._tcp.");
35 for (Service service
: services
) {
36 System
.out
.printf("\t%s:%d (%s)\n", service
.host
, service
.port
, service
.get("CtlN"));
38 switch (services
.size()) {
40 Service service
= services
.iterator().next();
43 System
.out
.println("Connecting...");
46 System
.out
.println("\tnone");
49 System
.out
.println("Please select a server ("+services
.size()+")");
54 StereoAmp amp
= new StereoAmp(host
, port
);