# Programmatic usage

Perform service discovery session:

    int timeout = 500; // milliseconds
    String query = "_services._dns-sd._udp.local.";	//DNS-SD query

    //instantiate protocol by name attribute
    IProtocol protocol = ProtocolFactory.getProtocol("DNS-SD");

    //instantiate transport by name attribute
    ITransport transport = TransportFactory.getTransport("UDP", "224.0.0.251", timeout);

    //get engine instance and kick off discovery
    ServiceDiscoveryEngine serviceDiscoveryEngine = ServiceDiscoveryEngine.getInstance();
    serviceDiscoveryEngine.doServiceDiscovery(query, protocol,transport);

Access EMF model:

    //get engine instance
    ServiceDiscoveryEngine serviceDiscoveryEngine = ServiceDiscoveryEngine.getInstance();

    //access org.eclipse.emf.ecore.resource.Resource
    Resource model = serviceDiscoveryEngine.getResource();