Class NSNetService

  • All Implemented Interfaces:
    NSObject

    public class NSNetService
    extends NSObject
    • Constructor Detail

      • NSNetService

        protected NSNetService​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • dataFromTXTRecordDictionary

        public static NSData dataFromTXTRecordDictionary​(NSDictionary<java.lang.String,​? extends NSData> txtDictionary)
        Returns an NSData created from the provided dictionary. The keys in the provided dictionary must be NSStrings, and the values must be NSDatas. If the dictionary cannot be converted into an NSData suitable for a TXT record, this method will return nil. For applications linked on or after Mac OS X 10.5, this method will throw an NSInvalidArgumentException if it is passed nil as the argument.
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • dictionaryFromTXTRecordData

        public static NSDictionary<java.lang.String,​? extends NSData> dictionaryFromTXTRecordData​(NSData txtData)
        Returns an NSDictionary created from the provided NSData. The keys will be UTF8-encoded NSStrings. The values are NSDatas. The caller is responsible for interpreting these as types appropriate to the keys. If the NSData cannot be converted into an appropriate NSDictionary, this method will return nil. For applications linked on or after Mac OS X 10.5, this method will throw an NSInvalidException if it is passed nil as the argument.
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • TXTRecordData

        public NSData TXTRecordData()
        Returns the raw TXT record of the NSNetService instance. If the instance has not been resolved, or the delegate's -netService:didUpdateTXTRecordData: has not been called, this will return nil. It is permitted to have a zero-length TXT record.
      • addresses

        public NSArray<? extends NSData> addresses()
        The addresses of the service. This is an NSArray of NSData instances, each of which contains a single struct sockaddr suitable for use with connect(2). In the event that no addresses are resolved for the service or the service has not yet been resolved, an empty NSArray is returned.
      • delegate

        public NSNetServiceDelegate delegate()
        Set a delegate to receive publish, resolve, or monitor events.
      • domain

        public java.lang.String domain()
        Returns the domain of the discovered or published service.
      • getInputStreamOutputStream

        public boolean getInputStreamOutputStream​(org.moe.natj.general.ptr.Ptr<NSInputStream> inputStream,
                                                  org.moe.natj.general.ptr.Ptr<NSOutputStream> outputStream)
        Retrieves streams from the NSNetService instance. The instance's delegate methods are not called. Returns YES if the streams requested are created successfully. Returns NO if or any reason the stream could not be created. If only one stream is desired, pass NULL for the address of the other stream. The streams that are created are not open, and are not scheduled in any run loop for any mode.
      • hostName

        public java.lang.String hostName()
        Returns the DNS host name of the computer hosting the discovered or published service. If a successful resolve has not yet occurred, this method will return nil.
      • includesPeerToPeer

        public boolean includesPeerToPeer()
        Initially set to NO. Set to YES to also publish, resolve, or monitor this service over peer to peer Wi-Fi (if available). Must be set before operation starts.
      • initWithDomainTypeName

        public NSNetService initWithDomainTypeName​(java.lang.String domain,
                                                   java.lang.String type,
                                                   java.lang.String name)
        This is the initializer for resolution. If you know the domain, type and name of the service for which you wish to discover addresses, you should initialize an NSNetService instance using this method and call resolve: on the result. If you wish to connect to this service immediately, you should call getInputStream:getOutputStream: on the result and forego the resolution step entirely. If publish: is called on an NSNetService instance initialized with this method, an NSNetServicesBadArgumentError will be sent in the error dictionary to the delegate's netService:didNotPublish: method.
      • initWithDomainTypeNamePort

        public NSNetService initWithDomainTypeNamePort​(java.lang.String domain,
                                                       java.lang.String type,
                                                       java.lang.String name,
                                                       int port)
        This is the initializer for publishing. You should use this initializer if you are going to announce the availability of a service on the network. To publish a service in all available domains, pass the empty string as the domain.
      • name

        public java.lang.String name()
        Returns the name of the discovered or published service.
      • port

        public long port()
        The port of a resolved service. This returns -1 if the service has not been resolved.
      • publish

        public void publish()
        Advertises a given service on the network. This method returns immediately. Success or failure is indicated by callbacks to the NSNetService instance's delegate. If the name of the service is the default name (@""), then the service will be renamed automatically. If the name of the service has been specified, then the service will not be renamed automatically. If more control over renaming is required, then -[NSNetService publishWithOptions:] is available.
      • publishWithOptions

        public void publishWithOptions​(long options)
        Advertises a given service on the network. This method returns immediately. Success or failure is indicated by callbacks to the NSNetService instance's delegate. See the notes above for NSNetServiceNoAutoRename for information about controlling the auto-renaming behavior using this method.
      • removeFromRunLoopForMode

        public void removeFromRunLoopForMode​(NSRunLoop aRunLoop,
                                             java.lang.String mode)
      • resolve

        @Deprecated
        public void resolve()
        Deprecated.
        Attempts to determine at least one address for the NSNetService instance. For applications linked on or after Mac OS X 10.4 "Tiger", this method calls -resolveWithTimeout: with a value of 5.0. Applications linked prior to Mac OS X 10.4 "Tiger" must call -stop on the instance after an appropriate (short) amount of time to avoid causing unnecessary network traffic.
      • resolveWithTimeout

        public void resolveWithTimeout​(double timeout)
        Starts a resolve for the NSNetService instance of the specified duration. If the delegate's -netServiceDidResolveAddress: method is called before the timeout expires, the resolve is successful. If the timeout is reached, the delegate's -netService:didNotResolve: method will be called. The value of the NSNetServicesErrorCode key in the error dictionary will be NSNetServicesTimeoutError.
      • scheduleInRunLoopForMode

        public void scheduleInRunLoopForMode​(NSRunLoop aRunLoop,
                                             java.lang.String mode)
        NSNetService instances may be scheduled on NSRunLoops to operate in different modes, or in other threads. It is generally not necessary to schedule NSNetServices in other threads. NSNetServices are scheduled in the current thread's NSRunLoop in the NSDefaultRunLoopMode when they are created.
      • setDelegate_unsafe

        public void setDelegate_unsafe​(NSNetServiceDelegate value)
        Set a delegate to receive publish, resolve, or monitor events.
      • setDelegate

        public void setDelegate​(NSNetServiceDelegate value)
        Set a delegate to receive publish, resolve, or monitor events.
      • setIncludesPeerToPeer

        public void setIncludesPeerToPeer​(boolean value)
        Initially set to NO. Set to YES to also publish, resolve, or monitor this service over peer to peer Wi-Fi (if available). Must be set before operation starts.
      • setTXTRecordData

        public boolean setTXTRecordData​(NSData recordData)
        Sets the TXT record of the NSNetService instance that has been or will be published. Pass nil to remove the TXT record from the instance.
      • startMonitoring

        public void startMonitoring()
        Starts monitoring the NSNetService instance for events. In Mac OS X 10.4 Tiger, monitored NSNetService instances inform their delegates of changes to the instance's TXT record by calling the delegate's -netService:didUpdateTXTRecordData: method.
      • stop

        public void stop()
        Halts a service which is either publishing or resolving.
      • stopMonitoring

        public void stopMonitoring()
        Stops monitoring the NSNetService instance for events.
      • type

        public java.lang.String type()
        Returns the type of the discovered or published service.