Core Foundation Sockets  v0.2(28.0)
 All Classes Files Functions Variables Properties
Instance Methods | Properties | List of all members
CFStreamPair Class Reference

Adds request-response semantics to a socket by encapsulating it with an input-output stream pair. More...

#import <CFStreamPair.h>

Inheritance diagram for CFStreamPair:
Inheritance graph
[legend]
Collaboration diagram for CFStreamPair:
Collaboration graph
[legend]

Instance Methods

(id) - initWithRequestStream:responseStream:
 
(id) - initWithSocketNativeHandle:
 
(void) - open
 Opens the request and response streams, scheduling them for service within the current run loop. More...
 
(void) - close
 Reverses the opening. More...
 
(NSData *) - receiveAvailableBytes
 Destructively receives bytes from the request buffer. More...
 
(NSString *) - receiveLineUsingEncoding:
 Special convenience method for receiving lines of text from the request stream based on a given string encoding. More...
 
(void) - sendBytes:
 
(void) - hasBytesAvailable
 
(void) - hasSpaceAvailable
 
(void) - sendBytes
 
(void) - handleRequestEvent:
 
(void) - handleResponseEvent:
 
(id) - init [implementation]
 
(void) - dealloc [implementation]
 
(void) - stream:handleEvent: [implementation]
 

Properties

id< CFStreamPairDelegatedelegate
 
NSInputStream * requestStream
 
NSOutputStream * responseStream
 
NSMutableData * requestBuffer [implementation]
 
NSMutableData * responseBuffer [implementation]
 

Detailed Description

Adds request-response semantics to a socket by encapsulating it with an input-output stream pair.

For TCP connections, the request input stream corresponds to the request; receive the request bytes from the request input, send the response to the response output stream.

Definition at line 47 of file CFStreamPair.h.

Method Documentation

- (void) close

Reverses the opening.

Closes the request and response streams, removes them from the current run loop. This assumes that you send -close from the same thread as you sent the original -open.

Definition at line 124 of file CFStreamPair.m.

- (void) dealloc
implementation

Definition at line 68 of file CFStreamPair.m.

- (void) handleRequestEvent: (NSStreamEvent)  eventCode

Definition at line 217 of file CFStreamPair.m.

- (void) handleResponseEvent: (NSStreamEvent)  eventCode

Definition at line 267 of file CFStreamPair.m.

- (void) hasBytesAvailable

Definition at line 185 of file CFStreamPair.m.

- (void) hasSpaceAvailable

Definition at line 197 of file CFStreamPair.m.

- (id) init
implementation

Definition at line 50 of file CFStreamPair.m.

- (id) initWithRequestStream: (NSInputStream *)  requestStream
responseStream: (NSOutputStream *)  responseStream 

Definition at line 74 of file CFStreamPair.m.

- (id) initWithSocketNativeHandle: (NSSocketNativeHandle)  socketNativeHandle

Definition at line 85 of file CFStreamPair.m.

- (void) open

Opens the request and response streams, scheduling them for service within the current run loop.

You cannot reopen the streams.

This method assumes that you have not already delegated, scheduled or opened the underlying request-response stream pair.

Definition at line 113 of file CFStreamPair.m.

- (NSData *) receiveAvailableBytes

Destructively receives bytes from the request buffer.

Definition at line 138 of file CFStreamPair.m.

- (NSString *) receiveLineUsingEncoding: (NSStringEncoding)  encoding

Special convenience method for receiving lines of text from the request stream based on a given string encoding.

The result includes any line termination characters. There could be more than one termination character at the end of the line since some line termination sequences span multiple characters.

Returns
Answers nil if the request buffer does not yet contain a complete line. Try again later.

Definition at line 145 of file CFStreamPair.m.

- (void) sendBytes

Definition at line 207 of file CFStreamPair.m.

- (void) sendBytes: (NSData *)  outputBytes

Definition at line 170 of file CFStreamPair.m.

- (void) stream: (NSStream *)  stream
handleEvent: (NSStreamEvent)  eventCode 
implementation

Definition at line 290 of file CFStreamPair.m.

Property Documentation

- (id<CFStreamPairDelegate>) delegate
readwriteatomicweak

Definition at line 49 of file CFStreamPair.h.

- (NSMutableData*) requestBuffer
readwriteatomicstrongimplementation

Definition at line 32 of file CFStreamPair.m.

- (NSInputStream*) requestStream
readwriteatomicstrong

Definition at line 50 of file CFStreamPair.h.

- (NSMutableData*) responseBuffer
readwriteatomicstrongimplementation

Definition at line 33 of file CFStreamPair.m.

- (NSOutputStream*) responseStream
readwriteatomicstrong

Definition at line 51 of file CFStreamPair.h.


The documentation for this class was generated from the following files: