The NetService class represents a network service that your application publishes or uses as a client. This class, along with the browser class NetServiceBrowser use multicast DNS to communicate accross the local network.
Your application can use this class to either publish information about a service, or as a client to retrieve information about another service.
If you intend to publish a service, you must setup the service to publish and acquire a port on which the socket will recieve connections. You can then create a NetService instance to represent your service and publish it.
If you intend to resolve a service, you can either use NetServiceBrowser to discover services of a given type, or you can create a new NetService object to resolve information about an known existing service. See NetServiceNetServiceNew(String, String, String) for information about creating new net services.
| C# | Visual Basic | Visual C++ |
public sealed class NetService : DNSService
Public NotInheritable Class NetService _ Inherits DNSService
public ref class NetService sealed : public DNSService
| All Members | Constructors | Methods | Properties | Events | |
| Icon | Member | Description |
|---|---|---|
| NetServiceNetServiceNew(String, String, String) |
Initializes a new instance of the NetService class for resolving.
| |
| NetServiceNetServiceNew(String, String, String, Int32) |
Initializes a new instance of the NetService class for publishing.
| |
| Addresses | Gets an IList object representing the available addresses of the resolved service. The objects in the list are IPEndPoints | |
| AllowApplicationForms |
Allows the application to attempt to post async replies over the
application "main loop" by using the message queue of the first available
open form (window). This is retrieved through
OpenForms.
(Inherited from DNSService.) | |
| AllowMultithreadedCallbacks |
If this is set to true, AllowApplicationForms
is set to false and InvokeableObject is set
to null, any time an asynchronous method needs to invoke a method in the
main loop, it will instead run the method in its own thread.
(Inherited from DNSService.) | |
| DataFromTXTRecordDictionary(IDictionary) |
Returns a byte[] object representing a TXT record
from a given dictionary.
| |
| DictionaryFromTXTRecordData(array<Byte>[]()) |
Returns an IDictionary representing a TXT record.
| |
| DidResolveService |
Occurs when a service was resolved.
| |
| DidUpdateTXT |
Occurs when the TXT record for a given service was updated.
| |
| Domain |
Gets the domain of the service.
| |
| Equals(Object) | (Inherited from Object.) | |
| Finalize()() | Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
| GetHashCode()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
| GetType()() | Gets the Type of the current instance. (Inherited from Object.) | |
| HostName |
Gets the host name of the computer providing the service.
| |
| InvokeableObject |
Set the ISynchronizeInvoke
object to use as the invoke object. When returning results from asynchronous calls,
the Invoke method on this object will be called to pass the results back
in a thread safe manner.
(Inherited from DNSService.) | |
| MemberwiseClone()() | Creates a shallow copy of the current Object. (Inherited from Object.) | |
| Name |
Gets the name of the service.
| |
| Publish()() |
Attempts to advertise the service on the network.
| |
| ResolveWithTimeout(Int32) |
Starts a resolve process with a timeout.
| |
| Stop()() |
Stops the currently running search or resolution.
| |
| ToString()() | (Inherited from Object.) | |
| TXTRecordData |
Gets or sets the TXT record data.
| |
| Type |
Gets the type of the service.
|
Network operations are performed asynchronously and are returned to your application via events fired from within this class. Events are typically fire in your application's main run loop, see DNSService for information about controlling asynchronous events.
It is important to note that this class uses the same asynchronous method to publish records as it does to fire events. So if you are simply publishing a service, you must still ensure that the DNSService parent class is properly placed into a run loop.
| Object | ||
| DNSService | ||
| NetService | ||