public static bool RemoveForwardTcpPort(SDBDeviceInfo device, int localPort, out string errorMessage) { string lastLine; bool success = SDBLib.RunSdbCommandAndGetLastNonEmptyLine(device, $"forward --remove tcp:{localPort}", out lastLine, out errorMessage); if (success && lastLine.StartsWith("error:")) { errorMessage = lastLine; success = false; } return(success); }
public static bool ForwardTcpPort(SDBDeviceInfo device, int localPort, int remotePort, out string errorMessage) { // TODO!! do need to remove port forwarding first? RemoveForwardTcpPort(device, localPort, out errorMessage); // remove forward error is a valid case string lastLine; bool success = SDBLib.RunSdbCommandAndGetLastNonEmptyLine(device, $"forward tcp:{localPort} tcp:{remotePort}", out lastLine, out errorMessage); if (success && lastLine.StartsWith("error:")) { errorMessage = lastLine; success = false; } return(success); }