コード例 #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);
        }
コード例 #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);
        }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #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);
     }
 }
コード例 #6
0
ファイル: CFStream.cs プロジェクト: baulig/maccore
        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);
            }
        }
コード例 #7
0
ファイル: CFStream.cs プロジェクト: baulig/maccore
        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);
        }
コード例 #8
0
ファイル: CFStream.cs プロジェクト: baulig/maccore
        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);
            }
        }
コード例 #9
0
ファイル: CFStream.cs プロジェクト: baulig/maccore
        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);
        }
コード例 #10
0
ファイル: CFStream.cs プロジェクト: baulig/maccore
 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);
 }
コード例 #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));
        }
コード例 #12
0
ファイル: CFStream.cs プロジェクト: polipo/maccore
		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);
			}
		}