Lines Matching refs:to
11 <h2>This lesson teaches you how to</h2>
15 <li><a href="#connect">Connect to Services on the Network</a></li>
36 <p>Adding Network Service Discovery (NSD) to your app allows your users to
38 requests. This is useful for a variety of peer-to-peer applications such as file
40 for you to implement such features.</p>
42 <p>This lesson shows you how to build an application that can broadcast its
43 name and connection information to the local network and scan for information
45 to connect to the same application running on another device.</p>
51 you can skip forward to the
56 that other devices on the network use when they're deciding whether to connect to your
64 // The name is subject to change based on conflicts
73 <p>This code snippet sets the service name to "NsdChat".
74 The name is visible to any device on the network that is using NSD to look for
78 them changes the service name automatically, to something like "NsdChat
86 service type to "_ipp._tcp".</p>
94 If you intend to use a new service type, you should reserve it by filling out
103 next available port. Because this information is provided to other apps by a
104 service broadcast, there's no need for the port your application uses to be
106 this information from your service broadcast, right before connecting to your
109 <p>If you're working with sockets, here's how you can initialize a socket to any
110 available port simply by setting it to 0.</p>
124 NsdServiceInfo} object, you need to implement the {@link
126 interface contains callbacks used by Android to alert your application of the
135 // Save the service name. Android may have changed it in order to
143 // Registration failed! Put debugging code here to determine why.
154 // Unregistration failed. Put debugging code here to determine why.
160 <p>Now you have all the pieces to register your service. Call the method
164 <p>Note that this method is asynchronous, so any code that needs to run
184 <p>The network is teeming with life, from the beastly network printers to the
185 docile network webcams, to the brutal, fiery battles of nearby tic-tac-toe
186 players. The key to letting your application see this vibrant ecosystem of
187 functionality is service discovery. Your application needs to listen to service
188 broadcasts on the network to see what services are available, and filter out
193 API call to {@link android.net.nsd.NsdManager#discoverServices(String
222 // connecting to. It could be "Bob's Chat App".
256 <p>The NSD API uses the methods in this interface to inform your application when discovery
261 <li>The service name of the found service is compared to the service
262 name of the local service to determine if the device just picked up its own
264 <li>The service type is checked, to verify it's a type of service your
265 application can connect to.</li>
266 <li>The service name is checked to verify connection to the correct
271 want to connect to a specific application. For instance, the application might
272 only want to connect to instances of itself running on other devices. However, if the
273 application wants to connect to a network printer, it's enough to see that the service type
278 your application should look for, the discovery protocol to use, and the
287 <h2 id="connect">Connect to Services on the Network</h2>
288 <p>When your application finds a service on the network to connect to, it
291 Implement a {@link android.net.nsd.NsdManager.ResolveListener} to pass into this
292 method, and use it to get a {@link android.net.nsd.NsdServiceInfo} containing
301 // Called when the resolve fails. Use the error code to debug.
323 you need to create your own network connection to the service.</p>
327 <p>It's important to enable and disable NSD
330 other applications from thinking it's still active and attempting to connect to
334 to start and stop service broadcast and discovery as appropriate.</p>