public static void CreateBoundPair(out CFReadStream readStream, out CFWriteStream writeStream, nint bufferSize) { IntPtr read, write; CFStreamCreateBoundPair(IntPtr.Zero, out read, out write, bufferSize); readStream = new CFReadStream(read); writeStream = new CFWriteStream(write); }
public static void CreatePairWithSocketToHost(IPEndPoint endpoint, out CFReadStream readStream, out CFWriteStream writeStream) { using (var host = CFHost.Create(endpoint)) { IntPtr read, write; CFStreamCreatePairWithSocketToCFHost(IntPtr.Zero, host.Handle, endpoint.Port, out read, out write); // API can return null streams readStream = read == IntPtr.Zero ? null : new CFReadStream(read); writeStream = write == IntPtr.Zero ? null : new CFWriteStream(write); } }
public static void CreatePairWithSocketToHost(string host, int port, out CFReadStream readStream, out CFWriteStream writeStream) { using (var str = new CFString(host)) { IntPtr read, write; CFStreamCreatePairWithSocketToHost( IntPtr.Zero, str.Handle, port, out read, out write); // API not annotated (yet?) but it's safe to bet it match CFStreamCreatePairWithSocketToCFHost readStream = read == IntPtr.Zero ? null : new CFReadStream(read); writeStream = write == IntPtr.Zero ? null : new CFWriteStream(write); } }
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 void CreatePairWithSocket(CFSocket socket, out CFReadStream readStream, out CFWriteStream writeStream) { if (socket == null) { throw new ArgumentNullException("socket"); } IntPtr read, write; CFStreamCreatePairWithSocket(IntPtr.Zero, socket.GetNative(), out read, out write); readStream = new CFReadStream(read); writeStream = new CFWriteStream(write); }
public static CFHTTPStream CreateForStreamedHTTPRequest(CFHTTPMessage request, CFReadStream body) { if (request == null) { throw new ArgumentNullException("request"); } if (body == null) { throw new ArgumentNullException("body"); } var handle = CFReadStreamCreateForStreamedHTTPRequest(IntPtr.Zero, request.Handle, body.Handle); return(new CFHTTPStream(handle)); }
public static CFHTTPStream CreateForStreamedHTTPRequest(CFHTTPMessage request, CFReadStream body) { if (request == null) throw new ArgumentNullException ("request"); if (body == null) throw new ArgumentNullException ("body"); var handle = CFReadStreamCreateForStreamedHTTPRequest (IntPtr.Zero, request.Handle, body.Handle); return new CFHTTPStream (handle); }
public static void CreatePairWithSocketToHost(IPEndPoint endpoint, out CFReadStream readStream, out CFWriteStream writeStream) { using (var host = CFHost.Create (endpoint)) { IntPtr read, write; CFStreamCreatePairWithSocketToCFHost (IntPtr.Zero, host.Handle, endpoint.Port, out read, out write); // API can return null streams readStream = read == IntPtr.Zero ? null : new CFReadStream (read); writeStream = write == IntPtr.Zero ? null : new CFWriteStream (write); } }
public static void CreatePairWithSocketToHost(string host, int port, out CFReadStream readStream, out CFWriteStream writeStream) { using (var str = new CFString (host)) { IntPtr read, write; CFStreamCreatePairWithSocketToHost ( IntPtr.Zero, str.Handle, port, out read, out write); // API not annotated (yet?) but it's safe to bet it match CFStreamCreatePairWithSocketToCFHost readStream = read == IntPtr.Zero ? null : new CFReadStream (read); writeStream = write == IntPtr.Zero ? null : new CFWriteStream (write); } }
public static void CreatePairWithSocket(CFSocket socket, out CFReadStream readStream, out CFWriteStream writeStream) { if (socket == null) throw new ArgumentNullException ("socket"); IntPtr read, write; CFStreamCreatePairWithSocket (IntPtr.Zero, socket.GetNative (), out read, out write); readStream = new CFReadStream (read); writeStream = new CFWriteStream (write); }
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 void CreateBoundPair(out CFReadStream readStream, out CFWriteStream writeStream, nint bufferSize) { IntPtr read, write; CFStreamCreateBoundPair (IntPtr.Zero, out read, out write, bufferSize); readStream = new CFReadStream (read); writeStream = new CFWriteStream (write); }