Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
 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);
     }
 }
Esempio n. 4
0
 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);
     }
 }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
 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);
     }
 }
Esempio n. 9
0
 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);
     }
 }
Esempio n. 10
0
        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);
        }
Esempio n. 11
0
 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);
     }
 }
Esempio n. 12
0
 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);
 }