Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSNetServiceMBS class.
NSNetServiceMBS.addresses as String()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
We take the raw addresses and decode IPv4 and IPv6 addresses for you.
NSNetServiceMBS.addressesIPv4 as String()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
We take the raw addresses and decode only IPv4 addresses for you.
NSNetServiceMBS.addressesIPv6 as String()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
We take the raw addresses and decode only IPv6 addresses for you.
NSNetServiceMBS.addressesRaw as MemoryBlock()
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
An array containing Memoryblock objects, each of which contains a socket address for the service. Each Memoryblock object in the returned array contains an appropriate sockaddr structure that you can use to connect to the socket. The exact type of this structure depends on the service to which you are connecting. If no addresses were resolved for the service, the returned array contains zero elements.
It is possible for a single service to resolve to more than one address or not resolve to any addresses. A service might resolve to multiple addresses if the computer publishing the service is currently multihoming.
NSNetServiceMBS.Constructor(Domain as String, Type as String, Name as String)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
domain: The domain for the service. To resolve in the default domains, pass in an empty string (""). To limit resolution to the local domain, use "local.".
If you are creating this object to resolve a service whose information your app stored previously, you should set this to the domain in which the service was originally discovered.
You can also use a NSNetServiceBrowserMBS object to obtain a list of possible domains in which you can discover and resolve services.
type: The network service type.
type must contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, as opposed to hosts, prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string "_http._tcp.". Note that the period character at the end of the string, which indicates that the domain name is an absolute name, is required.
name: The name of the service to resolve.
Returns the receiver, initialized as a network service named name of type type in the domain domain.
This method is the appropriate initializer to use to resolve a service—to publish a service, use Constructor with port.
If you know the values for domain, type, and name of the service you wish to connect to, you can create an NSNetServiceMBS object using this initializer and call resolve on the result.
You cannot use this initializer to publish a service. This initializer passes an invalid port number to the designated initializer, which prevents the service from being registered. Calling publish on an NSNetService object initialized with this method generates a call to your didNotPublish event with an NSNetServicesBadArgumentError error.
See also:
NSNetServiceMBS.Constructor(Domain as String, Type as String, Name as String, Port as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
domain: The domain for the service. To use the default registration domains, pass in an empty string (""). To limit registration to the local domain, use "local.".
You can also use a NSNetServiceBrowser object to obtain a list of possible domains in which you can publish your service.
type: The network service type.
type must contain both the service type and transport layer information. To ensure that the mDNS responder searches for services, as opposed to hosts, prefix both the service name and transport layer name with an underscore character (“_”). For example, to search for an HTTP service on TCP, you would use the type string "_http._tcp.". Note that the period character at the end of the string, which indicates that the domain name is an absolute name, is required.
name: The name by which the service is identified to the network. The name must be unique. If you pass the empty string (""), the system automatically advertises your service using the computer name as the service name.
port: The port on which the service is published.
If you specify the NSNetServiceListenForConnections flag, you may pass zero (0), in which case the service automatically allocates an arbitrary (ephemeral) port for your service. When the DidPublish event is called, you can determine the actual port chosen by calling the service object’s NSNetServiceMBS method or accessing the corresponding property.
If your app is listening for connections on its own, the value of port must be a port number acquired by your application for the service.
You use this method to create a service that you wish to publish on the network. Although you can also use this method to create a service you wish to resolve on the network, it is generally more appropriate to use the Constructor method instead.
When publishing a service, you must provide valid arguments in order to advertise your service correctly. If the host computer has access to multiple registration domains, you must create separate NSNetServiceMBS objects for each domain. If you attempt to publish in a domain for which you do not have registration authority, your request may be denied.
It is acceptable to use an empty string for the domain argument when publishing or browsing a service, but do not rely on this for resolution.
This method is the designated initializer.
See also:
NSNetServiceMBS.Constructor(other as NSNetServiceMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
You can subclass and fill in events. Then create a copy with this constructor to connect events.
See also:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
NSNetServiceMBS.getStreams(byref inputStream as NSInputStreamMBS, byref outputStream as NSOutputStreamMBS) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
inputStream: Upon return, the input stream for the receiver.
outputStream: Upon return, the output stream for the receiver.
Returns yes if the streams are created successfully, otherwise false.
After this method is called, no events are called by the receiver.
NSNetServiceMBS.isEqual(other as NSNetServiceMBS) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Returns true if equal or false if not.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
This method returns immediately, with success or failure indicated by the events.
This is equivalent to calling publish with the default options (0).
See also:
Some examples using this method:
NSNetServiceMBS.publish(options as Integer)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
options: Options for the receiver. The supported options are described in constants.
This method returns immediately, with success or failure indicated by the events.
See also:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Attempts to determine at least one address for the service. This method returns immediately, with success or failure indicated by the callbacks to the delegate.
See also:
NSNetServiceMBS.resolve(timeout as Double)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
timeout: The maximum number of seconds to attempt a resolve. A value of 0.0 indicates no timeout and a resolve process of indefinite duration.
During the resolve period, the service sends DidResolveAddress event for each address it discovers that matches the service parameters. Once the timeout is hit, the service sends DidStop event. If no addresses resolve during the timeout period, the service sends didNotResolve event.
See also:
NSNetServiceMBS.setTXTRecordData(Data as MemoryBlock) as Boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Data: The TXT record for the receiver.
True if recordData is successfully set as the TXT record, otherwise false.
NSNetServiceMBS.startMonitoring
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
Please implement didUpdateTXTRecordData event, which is called when the TXT record for the receiver is updated.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
We raise DidStop event after the service stops.
It is safe to remove all strong references to the service immediately after calling stop.
NSNetServiceMBS.stopMonitoring
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa Networking | MBS MacFrameworks Plugin | 21.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
The items on this page are in the following plugins: MBS MacFrameworks Plugin.