public static void CreatePairWithPeerSocketSignature(AddressFamily family, SocketType type, ProtocolType proto, IPEndPoint endpoint, out CFReadStream readStream, out CFWriteStream writeStream) { using (var address = new CFSocketAddress(endpoint)) { var sig = new CFSocketSignature(family, type, proto, address); IntPtr read, write; CFStreamCreatePairWithPeerSocketSignature(IntPtr.Zero, ref sig, out read, out write); readStream = new CFReadStream(read); writeStream = new CFWriteStream(write); } }
public static CFSocket CreateConnectedToSocketSignature(AddressFamily family, SocketType type, ProtocolType proto, IPEndPoint endpoint, double timeout) { var cbTypes = CFSocketCallBackType.ConnectCallBack | CFSocketCallBackType.DataCallBack; using (var address = new CFSocketAddress(endpoint)) { var sig = new CFSocketSignature(family, type, proto, address); var handle = CFSocketCreateConnectedToSocketSignature( IntPtr.Zero, ref sig, (nuint)(ulong)cbTypes, OnCallback, IntPtr.Zero, timeout); if (handle == IntPtr.Zero) { throw new CFSocketException(CFSocketError.Error); } return(new CFSocket(handle)); } }
public static void CreatePairWithPeerSocketSignature(AddressFamily family, SocketType type, ProtocolType proto, IPEndPoint endpoint, out NSInputStream readStream, out NSOutputStream writeStream) { using (var address = new CFSocketAddress (endpoint)) { var sig = new CFSocketSignature (family, type, proto, address); IntPtr read, write; CFStream.CFStreamCreatePairWithPeerSocketSignature (IntPtr.Zero, ref sig, out read, out write); AssignStreams (read, write, out readStream, out writeStream); } }
internal extern static void CFStreamCreatePairWithPeerSocketSignature(/* CFAllocatorRef */ IntPtr allocator, /* CFSocketSignature* */ ref CFSocketSignature sig, /* CFReadStreamRef* */ out IntPtr readStream, /* CFWriteStreamRef* */ out IntPtr writeStream);
internal static extern void CFStreamCreatePairWithPeerSocketSignature(/* CFAllocatorRef */ IntPtr allocator, /* CFSocketSignature* */ ref CFSocketSignature sig, /* CFReadStreamRef* */ out IntPtr readStream, /* CFWriteStreamRef* */ out IntPtr writeStream);
extern static IntPtr CFSocketCreateConnectedToSocketSignature(IntPtr allocator, ref CFSocketSignature signature, nuint /*CFOptionFlags*/ callBackTypes, CFSocketCallBack callout, IntPtr context, double timeout);
public CFSocket(AddressFamily family, SocketType type, ProtocolType proto, CFRunLoop loop) : this(CFSocketSignature.AddressFamilyToInt(family), CFSocketSignature.SocketTypeToInt(type), CFSocketSignature.ProtocolToInt(proto), loop) { }
static extern IntPtr CFSocketCreateConnectedToSocketSignature(IntPtr allocator, ref CFSocketSignature signature, nuint /*CFOptionFlags*/ callBackTypes, CFSocketCallBack callout, IntPtr context, double timeout);
public static CFSocket CreateConnectedToSocketSignature(AddressFamily family, SocketType type, ProtocolType proto, IPEndPoint endpoint, double timeout) { var cbTypes = CFSocketCallBackType.ConnectCallBack | CFSocketCallBackType.DataCallBack; using (var address = new CFSocketAddress (endpoint)) { var sig = new CFSocketSignature (family, type, proto, address); var handle = CFSocketCreateConnectedToSocketSignature ( IntPtr.Zero, ref sig, (nuint) (ulong) cbTypes, OnCallback, IntPtr.Zero, timeout); if (handle == IntPtr.Zero) throw new CFSocketException (CFSocketError.Error); return new CFSocket (handle); } }