@interface
NSStream :
NSObject
- (void)open;
-
(void)close;
-
(id
<NSStreamDelegate>)delegate;
- (void)setDelegate:(id
<NSStreamDelegate>)delegate;
// By default, a stream is its own delegate, and subclassers of NSInputStream and NSOutputStream must maintain this contract. [someStream
setDelegate:nil] must restore this behavior. As usual, delegates are not retained.
-
(id)propertyForKey:(NSString *)key;
- (BOOL)setProperty:(id)property
forKey:(NSString *)key;
- (void)scheduleInRunLoop:(NSRunLoop
*)aRunLoop forMode:(NSString *)mode;
-
(void)removeFromRunLoop:(NSRunLoop *)aRunLoop
forMode:(NSString *)mode;
-
(NSStreamStatus)streamStatus;
- (NSError *)streamError;
@end
@protocol
NSStreamDelegate
<NSObject>
@optional
-
(void)stream:(NSStream *)aStream
handleEvent:(NSStreamEvent)eventCode;
@end
#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE))//不能在ios上使用
@interface
NSStream (NSSocketStreamCreationExtensions)
+ (void)getStreamsToHost:(NSHost
*)host port:(NSInteger)port
inputStream:(NSInputStream **)inputStream
outputStream:(NSOutputStream **)outputStream;
@end
#endif