Düzenle

Aracılığıyla paylaş


CFStream Class

Definition

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

public abstract class CFStream : CoreFoundation.CFType, IDisposable, ObjCRuntime.INativeObject
type CFStream = class
    inherit CFType
    interface INativeObject
    interface IDisposable
Inheritance
CFStream
Derived
Implements

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

CFStream(IntPtr)

Properties

Handle

Handle (pointer) to the unmanaged object representation.

ReadDispatchQueue
WriteDispatchQueue

Methods

CheckError()
CheckHandle()
Close()
CreateBoundPair(CFReadStream, CFWriteStream, nint)

Creates two streams that act as a pipe. They are bound together, what is written on the writing stream can be read by the reading stream.

CreateForHTTPRequest(CFHTTPMessage)

Developers should not use this deprecated method. Developers should use 'NSUrlSession'.

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()

Releases the resources used by the CFStream object.

Dispose(Boolean)

Releases the resources used by the CFStream object.

DoClose()
DoGetProperty(NSString)
DoGetStatus()
DoOpen()
DoSetClient(CFStream+CFStreamCallback, nint, IntPtr)
DoSetProperty(NSString, INativeObject)
EnableEvents(CFRunLoop, NSString)
Finalize()

Finalizer for the CFStream object

GetDescription(IntPtr)

Returns a textual representation of the specified object.

(Inherited from CFType)
GetError()
GetStatus()
OnCallback(CFStreamEventType)
OnCanAcceptBytesEvent(CFStream+StreamEventArgs)
OnClosedEvent(CFStream+StreamEventArgs)
OnErrorEvent(CFStream+StreamEventArgs)
OnHasBytesAvailableEvent(CFStream+StreamEventArgs)
OnOpenCompleted(CFStream+StreamEventArgs)
Open()
ScheduleWithRunLoop(CFRunLoop, NSString)
UnscheduleFromRunLoop(CFRunLoop, NSString)

Events

CanAcceptBytesEvent
ClosedEvent
ErrorEvent
HasBytesAvailableEvent
OpenCompletedEvent

Applies to