Share via


CFStream Class

Definition

An abstract class that defines a stream for reading or writing bytes - modern applications should use the Network APIs instead.

public abstract class CFStream : CoreFoundation.CFType
type CFStream = class
    inherit CFType
Inheritance
Derived

Remarks

Converting CFStreams to NSStreams

If you need to turn a CFStream into an NSStream, or an NSStream subclass, you can do so by surfacing an NSStream version of the method like this:

CFReadStream readStream;
CFWriteStream writeStream;
CFStream.CreatePairWithSocketToHost("www.google.com", 80, out readStream, out writeStream);

// 
// Get NSStream variatns
//
_inputStream = ObjCRuntime.Runtime.GetNSObject<NSInputStream>(readStream.Handle);
_outputStream =
ObjCRuntime.Runtime.GetNSObject<NSOutputStream>(writeStream.Handle);

Constructors

Name Description
CFStream(NativeHandle, Boolean)

Properties

Name Description
Handle (Inherited from DisposableObject)
Owns (Inherited from DisposableObject)
ReadDispatchQueue
WriteDispatchQueue

Methods

Name Description
CheckError()
ClearHandle() (Inherited from DisposableObject)
Close()
CreateBoundPair(CFReadStream, CFWriteStream, IntPtr)
CreateForHTTPRequest(CFHTTPMessage)
CreateForStreamedHTTPRequest(CFHTTPMessage, CFReadStream)
CreateForStreamedHTTPRequest(CFHTTPMessage, NSInputStream)
CreatePairWithPeerSocketSignature(AddressFamily, SocketType, ProtocolType, IPEndPoint, CFReadStream, CFWriteStream)

Creates a reading and a writing CFStream to an endpoint that are configured to use a specific socket address family, a socket type and a protocol.

CreatePairWithSocket(CFSocket, CFReadStream, CFWriteStream)

Creates a reading and a writing CFStream on top of an existing socket.

CreatePairWithSocketToHost(IPEndPoint, CFReadStream, CFWriteStream)

Creates a reading and a writing CFStreams that are connected over TCP/IP to the specified endpoint.

CreatePairWithSocketToHost(String, Int32, CFReadStream, CFWriteStream)

Creates a reading and a writing CFStreams that are connected over TCP/IP to the specified host and port.

Dispose() (Inherited from DisposableObject)
Dispose(Boolean)

Releases the resources used by the CFStream object.

DoClose()
DoGetProperty(NSString)
DoGetStatus()
DoOpen()
DoSetClient(CFStream+CFStreamCallback, IntPtr, IntPtr)
DoSetClient(delegate* unmanaged<IntPtr, IntPtr, IntPtr, Void>, IntPtr, IntPtr)
DoSetProperty(NSString, INativeObject)
EnableEvents(CFRunLoop, NSString)
Equals(Object) (Inherited from DisposableObject)
GetCheckedHandle() (Inherited from DisposableObject)
GetDescription(IntPtr)

Returns a textual representation of the specified object.

(Inherited from CFType)
GetError()
GetHashCode() (Inherited from DisposableObject)
GetStatus()
InitializeHandle(NativeHandle) (Inherited from DisposableObject)
OnCallback(CFStreamEventType)
OnCanAcceptBytesEvent(CFStream+StreamEventArgs)
OnClosedEvent(CFStream+StreamEventArgs)
OnErrorEvent(CFStream+StreamEventArgs)
OnHasBytesAvailableEvent(CFStream+StreamEventArgs)
OnOpenCompleted(CFStream+StreamEventArgs)
Open()
Release() (Inherited from NativeObject)
Retain() (Inherited from NativeObject)
ScheduleWithRunLoop(CFRunLoop, NSString)
UnscheduleFromRunLoop(CFRunLoop, NSString)

Events

Name Description
CanAcceptBytesEvent
ClosedEvent
ErrorEvent
HasBytesAvailableEvent
OpenCompletedEvent

Extension Methods

Name Description
GetHandle(INativeObject)
GetNonNullHandle(INativeObject, String)

Applies to