コード例 #1
0
        Tunnel(SafeTunnelHandle handle, DeviceConnection owner)
        {
            Log.Write("Tunnel.Tunnel()");

            this.handle = handle;
            this.owner  = owner;
        }
コード例 #2
0
        internal static Tunnel Create(DeviceConnection owner, int localPort, string device, string remoteHost, int remotePort)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            if (remoteHost == null)
            {
                throw new ArgumentNullException("remoteHost");
            }

            IntPtr nativeHandle;

            PlatformAdapter.Instance.nabtoTunnelOpenTcp(out nativeHandle, owner.Owner.GetNativeHandle(), localPort, device, remoteHost, remotePort);

            var safeHandle = new SafeTunnelHandle(nativeHandle);

            var instance = new Tunnel(safeHandle, owner);

            owner.Register(instance);

            return(instance);
        }