示例#1
0
 /// <summary>
 /// Forwards a remote Unix socket to a local TCP socket.
 /// </summary>
 /// <param name="client">
 /// An instance of a class that implements the <see cref="IAdbClient"/> interface.
 /// </param>
 /// <param name="device">
 /// The device to which to forward the connections.
 /// </param>
 /// <param name="localPort">
 /// The local port to forward.
 /// </param>
 /// <param name="remoteSocket">
 /// The remote Unix socket.
 /// </param>
 /// <exception cref="AdbException">
 /// The client failed to submit the forward command.
 /// </exception>
 /// <exception cref="AdbException">
 /// The device rejected command. The error message will include the error message provided by the device.
 /// </exception>
 public static int CreateForward(this IAdbClient client, DeviceData device, int localPort, string remoteSocket)
 {
     return(client.CreateForward(device, $"tcp:{localPort}", $"local:{remoteSocket}", true));
 }
示例#2
0
 /// <summary>
 ///  Creates a port forwarding between a local and a remote port.
 /// </summary>
 /// <param name="client">
 /// An instance of a class that implements the <see cref="IAdbClient"/> interface.
 /// </param>
 /// <param name="device">
 /// The device to which to forward the connections.
 /// </param>
 /// <param name="localPort">
 /// The local port to forward.
 /// </param>
 /// <param name="remotePort">
 /// The remote port to forward to
 /// </param>
 /// <exception cref="AdbException">
 /// failed to submit the forward command.
 /// or
 /// Device rejected command:  + resp.Message
 /// </exception>
 public static void CreateForward(this IAdbClient client, DeviceData device, int localPort, int remotePort)
 {
     client.CreateForward(device, $"tcp:{localPort}", $"tcp:{remotePort}", true);
 }