Class: NSMachPort
Overview
NSMachPort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). NSMachPort is an object wrapper for a Mach port, the fundamental communication port in OS X. NSMachPort allows for local (on the same machine) communication only. A companion class, NSSocketPort, allows for both local and remote distributed object communication, but may be more expensive than NSMachPort for the local case.
Class Method Summary (collapse)
-
+ portWithMachPort:
Creates and returns a port object configured with the given Mach port.
-
+ portWithMachPort:options:
Creates and returns a port object configured with the specified options and the given Mach port.
Instance Method Summary (collapse)
-
- delegate
Returns the receiver’s delegate.
-
- initWithMachPort:
Initializes a newly allocated NSMachPort object with a given Mach port.
-
- initWithMachPort:options:
Initializes a newly allocated NSMachPort object with a given Mach port and the specified options.
-
- machPort
Returns as an int the Mach port used by the receiver.
-
- removeFromRunLoop:forMode:
Removes the receiver from the run loop mode mode of runLoop.
-
- scheduleInRunLoop:forMode:
Schedules the receiver into the run loop mode mode of runLoop.
-
- setDelegate:
Sets the receiver’s delegate to a given object.
Methods inherited from NSPort
#invalidate, #isValid, port, #reservedSpaceLength, #sendBeforeDate:components:from:reserved:, #sendBeforeDate:msgid:components:from:reserved:
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Class Method Details
+ (NSPort) portWithMachPort(machPort)
Creates and returns a port object configured with the given Mach port. Creates the port object if necessary. Depending on the access rights associated with machPort, the new port object may be usable only for sending messages.
+ (NSPort) portWithMachPort(machPort, options:options)
Creates and returns a port object configured with the specified options and the given Mach port. Creates the port object if necessary. Depending on the access rights associated with machPort, the new port object may be usable only for sending messages.
Instance Method Details
- (Object) delegate
Returns the receiver’s delegate.
- (Object) initWithMachPort(machPort)
Initializes a newly allocated NSMachPort object with a given Mach port. Depending on the access rights for machPort, the new port may be able to only send messages. If a port with machPort already exists, this method deallocates the receiver, then retains and returns the existing port.This method is the designated initializer for the NSMachPort class.
- (Object) initWithMachPort(machPort, options:options)
Initializes a newly allocated NSMachPort object with a given Mach port and the specified options. Depending on the access rights for machPort, the new port may be able to only send messages. If a port with machPort already exists, this method deallocates the receiver, then retains and returns the existing port.
- (Integer) machPort
Returns as an int the Mach port used by the receiver.
- (Object) removeFromRunLoop(runLoop, forMode:mode)
Removes the receiver from the run loop mode mode of runLoop. When the receiver is removed, the run loop stops monitoring the Mach port for incoming messages.
- (Object) scheduleInRunLoop(runLoop, forMode:mode)
Schedules the receiver into the run loop mode mode of runLoop. When the receiver is scheduled, the run loop monitors the mach port for incoming messages and, when a message arrives, invokes the delegate method handleMachMessage:.
- (Object) setDelegate(anObject)
Sets the receiver’s delegate to a given object.