FileDocCategorySizeDatePackage
TestResolve.javaAPI DocExample1532Thu Jul 07 08:17:16 BST 2005None

TestResolve

public class TestResolve extends Object implements ResolveListener

Fields Summary
Constructors Summary
public TestResolve(String name, String domain)

		System.out.println("TestResolve Starting");
		DNSSDService r = DNSSD.resolve(0, DNSSD.ALL_INTERFACES,
			name, "_example._tcp", domain, this);
		System.out.println("TestResolve Running");
		Thread.sleep(5000);
		System.out.println("TestResolve Stopping");
		r.stop();
		
Methods Summary
public static voidmain(java.lang.String[] args)

		if (args.length != 2)
			{
			System.out.println("Usage: java TestResolve name domain");
			System.exit(-1);
			}
		else
			{
			try
				{
				new TestResolve(args[0], args[1]);
				}
			catch (Exception e)
				{
				e.printStackTrace();
				System.exit(-1);
				} 
			}
		
public voidoperationFailed(DNSSDService service, int errorCode)

		System.out.println("Resolve failed " + errorCode);
		System.exit(-1);
		
public voidserviceResolved(DNSSDService resolver, int flags, int ifIndex, java.lang.String fullName, java.lang.String hostName, int port, TXTRecord txtRecord)

		System.out.println("Service Resolved: " + hostName + ":" + port);
		System.out.println("Flags: " + flags +
			", ifIndex: " + ifIndex + ", FQDN: " + fullName);

		for (int i = 0; i < txtRecord.size(); i++)
			{
			String key = txtRecord.getKey(i);
			String value = txtRecord.getValueAsString(i);
			if (key.length() > 0) System.out.println("\t" + key + "=" + value);
			}