Exemple #1
0
        public static void CreateBoundPair(out CFReadStream readStream, out CFWriteStream writeStream, int bufferSize)
        {
            IntPtr read, write;

            CFStreamCreateBoundPair(IntPtr.Zero, out read, out write, bufferSize);
            readStream  = new CFReadStream(read);
            writeStream = new CFWriteStream(write);
        }
Exemple #2
0
        public static void CreatePairWithSocket(CFSocket socket, out CFReadStream readStream,
                                                out CFWriteStream writeStream)
        {
            IntPtr read, write;

            CFStreamCreatePairWithSocket(IntPtr.Zero, socket.GetNative(), out read, out write);
            readStream  = new CFReadStream(read);
            writeStream = new CFWriteStream(write);
        }
Exemple #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);
         readStream  = new CFReadStream(read);
         writeStream = new CFWriteStream(write);
     }
 }
Exemple #4
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);
         readStream  = new CFReadStream(read);
         writeStream = new CFWriteStream(write);
     }
 }
Exemple #5
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);
     }
 }
Exemple #6
0
        public static void CreatePairWithSocketToHost(IPEndPoint endpoint,
		                                               out CFReadStream readStream,
		                                               out CFWriteStream writeStream)
        {
            using (var host = CFHost.CreateWithAddress (endpoint.Address)) {
                IntPtr read, write;
                CFStreamCreatePairWithSocketToCFHost (
                    IntPtr.Zero, host.Handle, endpoint.Port, out read, out write);
                readStream = new CFReadStream (read);
                writeStream = new CFWriteStream (write);
            }
        }
Exemple #7
0
        public static void CreatePairWithSocket(CFSocket socket, out CFReadStream readStream,
		                                         out CFWriteStream writeStream)
        {
            IntPtr read, write;
            CFStreamCreatePairWithSocket (IntPtr.Zero, socket.GetNative (), out read, out write);
            readStream = new CFReadStream (read);
            writeStream = new CFWriteStream (write);
        }
Exemple #8
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);
            }
        }
Exemple #9
0
        public static CFHTTPStream CreateForStreamedHTTPRequest(CFHTTPMessage request, CFReadStream body)
        {
            var handle = CFReadStreamCreateForStreamedHTTPRequest (IntPtr.Zero, request.Handle, body.Handle);
            if (handle == IntPtr.Zero)
                return null;

            return new CFHTTPStream (handle);
        }
Exemple #10
0
 public static void CreateBoundPair(out CFReadStream readStream, out CFWriteStream writeStream, int bufferSize)
 {
     IntPtr read, write;
     CFStreamCreateBoundPair (IntPtr.Zero, out read, out write, bufferSize);
     readStream = new CFReadStream (read);
     writeStream = new CFWriteStream (write);
 }
Exemple #11
0
        public static CFHTTPStream CreateForStreamedHTTPRequest(CFHTTPMessage request, CFReadStream body)
        {
            var handle = CFReadStreamCreateForStreamedHTTPRequest(IntPtr.Zero, request.Handle, body.Handle);

            if (handle == IntPtr.Zero)
            {
                return(null);
            }

            return(new CFHTTPStream(handle));
        }
Exemple #12
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);
				readStream = new CFReadStream (read);
				writeStream = new CFWriteStream (write);
			}
		}