Saturday, April 27, 2013

NSFileHandle acceptConnectionInBackgroundAndNotifyForModes example ios


acceptConnectionInBackgroundAndNotifyForModes:

Accepts a socket connection (for stream-type sockets only) in the background and creates a file handle for the “near” (client) end of the communications channel.
- (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray *)modes
Parameters
modes
The runloop modes in which the connection accepted notification can be posted.
Discussion of [NSFileHandle acceptConnectionInBackgroundAndNotifyForModes]
See acceptConnectionInBackgroundAndNotify for details of how this method operates. This method differs from acceptConnectionInBackgroundAndNotify in that modes specifies the run-loop mode (or modes) in whichNSFileHandleConnectionAcceptedNotification can be posted.[NSFileHandle acceptConnectionInBackgroundAndNotifyForModes]
You must call this method from a thread that has an active run loop.
Example of [NSFileHandle acceptConnectionInBackgroundAndNotifyForModes]
[handle10  acceptConnectionInBackgroundAndNotifyForModes:[NSArray arrayWithObject:NSEventTrackingRunLoopMode]];