What does “adb forward tcp" do? - General Questions and Answers

Hi all,
Apparently, this adb command is to forward a specific port on the host (namely, some laptop) to a specific port on the device (eg. your android phone), if my understanding is correct.
What does 'adb forward tcp:8080 tcp:8080' command do?
While working on Android development, I have come across the command adb forward tcp:8080 tcp:8080 many times. What does it actually do? and why 8080?
stackoverflow.com
Ultimately, is it to execute commands on laptop, so that these commands would be effective on your android phone? Or in other words, the commands typed in your Command / Cygwin window on laptop could be forwarded to your android phone?
Thanks in advance for your advice.
Regards,

wenyendev said:
Hi all,
Apparently, this adb command is to forward a specific port on the host (namely, some laptop) to a specific port on the device (eg. your android phone), if my understanding is correct.
What does 'adb forward tcp:8080 tcp:8080' command do?
While working on Android development, I have come across the command adb forward tcp:8080 tcp:8080 many times. What does it actually do? and why 8080?
stackoverflow.com
Ultimately, is it to execute commands on laptop, so that these commands would be effective on your android phone? Or in other words, the commands typed in your Command / Cygwin window on laptop could be forwarded to your android phone?
Thanks in advance for your advice.
Regards,
Click to expand...
Click to collapse
It connects a port on the host device to another port on the secondary device then forwards all commands from the host port to the secondary port.

1. It maps a port on host device ( here: PC ) to a port on Android device.
2. Port 8080 is typically used as proxy and caching port. It's also above the service port range. Port 8080 also can run a Web server as a nonroot user.

I use a Raspberry Pi as a home server.
I have a retired Barnes&Noble Glowlight 3 6" ereader that I use as a status/weather display.
Sure, I could use it over WiFi, but why not run it over USB since it has to be plugged in anyway?
I have a service running on the RPi, I forward a port from the RPi to the Glow and I have an app running on the Glow.
I still can do a normal adb shell on the RPi (while the forwarding is also running) to administer/update the Glow.

Related

Linux -> sms via WM device

Hi All
I am looking for a solution:
Is there any way to send SMS via Windows Mobile based device (HTC raphael in my case) which is connected to Linux system through USB cable?
Linux Box has no internet assess so solution of sending sms through internet gateways is not good for me
The tool that i am looking for must run in console (can't use KDE, GNOME etc...) just command line utility.
regards
Lucas

How to use terminal?

I've read in a few threads which required the use of terminal/fast boot.
What exactly is this? Can anybody point me to a guide/tutorial on how to use it?
Thanks in advance!
P.S. - I am a newbie in playing around with the Android system.
bump bump bump
Terminal basically allows you to run certain commands directly on your device rather than having to be coupled to your pc.
Android Terminal Emulator
Description
This application lets you access your Android's built-in Linux command line shell. It emulates a Digital Equipment Corporation VT-100 terminal. You can use this application to run utility programs on your device.
What is this app good for?
This application lets you run Linux command line utilities on your Android phone. It is mostly useful for computer programmers. It might also be useful for people who want to explore the Linux internals of their Android phone.
Click to expand...
Click to collapse
Some Android basics - http://forum.xda-developers.com/showthread.php?t=619153
How to use ADB - http://forum.xda-developers.com/showthread.php?t=502010
Terminal commands - http://www.busybox.net/downloads/BusyBox.html

SFTP client with multi-hop support for JB?

I have a Samsung Galaxy Note 10.1 running jelly bean 4.1. I have been using JuiceSSH a lot to access a machine which does not directly connect to the internet, using the "connect via option". I connect to an intermediate machine first, and then from there it open a ssh session on the second host. On my home computer, I do this with ssh proxy command. I've been searching here and on the play store for a way to access an sftp server running on the remote machine capable of passing through this "proxy" server, but I haven't found anything.
I could just install open-ssh on my tablet, I suppose and do it directly from the command line, but I don't want to root the device.
Any help would be greatly appreciated
Steve :laugh:
sjchicago1987 said:
I have a Samsung Galaxy Note 10.1 running jelly bean 4.1. I have been using JuiceSSH a lot to access a machine which does not directly connect to the internet, using the "connect via option". I connect to an intermediate machine first, and then from there it open a ssh session on the second host. On my home computer, I do this with ssh proxy command. I've been searching here and on the play store for a way to access an sftp server running on the remote machine capable of passing through this "proxy" server, but I haven't found anything.
I could just install open-ssh on my tablet, I suppose and do it directly from the command line, but I don't want to root the device.
Any help would be greatly appreciated
Steve :laugh:
Click to expand...
Click to collapse
Hey Steve,
Dev of JuiceSSH here... sorry as you know we don't support SFTP (yet!) - however in the meantime you could setup a port forward in JuiceSSH to forward traffic from a local port on your android device to the final destination. It would look something like this:
Mode: Local
Connection: <your intermediate server connection>
Port (from): 5000 (could be any > 1024)
Destination: <your sftp server hostname>
Port (to): 22
Then use any SFTP client currently available on Android and connect to the local port (which would route through the JuiceSSH port forward to the intermediate server then onto the destination).
Thanks
Paul
protocol mismatch
SSH-2.0-OpenSSH_6.1p1 Debian-4 Protocol mismatch.SH-2.0-OpenSSH_6.1p1 Debian-4 Protocol mismatch.
JuiceSSH said:
Hey Steve,
Dev of JuiceSSH here... sorry as you know we don't support SFTP (yet!) - however in the meantime you could setup a port forward in JuiceSSH to forward traffic from a local port on your android device to the final destination. It would look something like this:
Mode: Local
Connection: <your intermediate server connection>
Port (from): 5000 (could be any > 1024)
Destination: <your sftp server hostname>
Port (to): 22
Then use any SFTP client currently available on Android and connect to the local port (which would route through the JuiceSSH port forward to the intermediate server then onto the destination).
Thanks
Paul
Click to expand...
Click to collapse
Paul, thanks for the help. I've tried configuring a Port Forward as you suggest, but there seems to be a problem communicating with the open-ssh server on my machine. I can connect to the machine normally through "connect-via" however. I asked for the forward to open a browser session. When it does, this message is displayed (in the browser)
SSH-2.0-OpenSSH_6.1p1 Debian-4 protocol mismatch.
Any ideas?
You'll need to use an SFTP app, rather than the browser as the android browser doesn't support SFTP.
Download an SFTP client off the Play Store and point it at 127.0.0.1 once the port forward is active.

Use ADB on Android device in a Linux chroot / proot to control other Android device

On a non rooted Samsung Galaxy tab 2 7.0" I have the app GNUroot Debian installed. This is a chroot (actually it is called PRoot, see below for a description) Linux distribution - currently Debian 'Jessie' - with a terminal. I have installed the android-tools-adb package from the Debian Jessie repository. This means the chroot environment has access to the tablet's network hardware.
Now I would like to control another device (I have a non rooted Huawei Ascend Y300) from the tablet using adb inside the chroot terminal. I managed to do this through WiFi by first connecting the phone to a pc and run the terminal command 'adb tcpip 5555'. Then, on the tablet in the GNUroot Debian app terminal running the command 'adb connect xxx.xxx.x.x' gives adb control from the tablet over the phone through the local wifi network. Nice!
It would be even better to manage the adb control between two android devices from a chroot / PRoot environment without the pc, for example using an On The Go cable. Assuming non rooted devices. The tablet in question (Samsung Galaxy tab 2 7.0") has usb host capabilities. So in theory it could be done with a usb On The Go cable connecting the two Android devices.
Questions:
Is it possible to use adb within the described chroot / PRroot environment to run commands to controle another Android device, when both Android devices are connected through a USB On The Go cable?
Does a chroot / PRoot environment give access to the usb port as host?
Information:
The reason for this question is the development of an app on my tablet, using the Android IDE app, which must be tested on other (non rooted) Android devices. Preferably from the tablet, preferably without a pc.
Description of PRoot from 'proot-me' repository at github.com:
==
PRoot is a user-space implementation of ``chroot``, ``mount --bind``,
and ``binfmt_misc``. This means that users don't need any privileges
or setup to do things like using an arbitrary directory as the new
root filesystem, making files accessible somewhere else in the
filesystem hierarchy, or executing programs built for another CPU
architecture transparently through QEMU user-mode. Also, developers
can use PRoot as a generic Linux process instrumentation engine thanks
to its extension mechanism, see CARE_ for an example. Technically
PRoot relies on ``ptrace``, an unprivileged system-call available in
every Linux kernel.
The new root file-system, a.k.a *guest rootfs*, typically contains a
Linux distribution. By default PRoot confines the execution of
programs to the guest rootfs only, however users can use the built-in
*mount/bind* mechanism to access files and directories from the actual
root file-system, a.k.a *host rootfs*, just as if they were part of
the guest rootfs.
When the guest Linux distribution is made for a CPU architecture
incompatible with the host one, PRoot uses the CPU emulator QEMU
user-mode to execute transparently guest programs. It's a convenient
way to develop, to build, and to validate any guest Linux packages
seamlessly on users' computer, just as if they were in a *native*
guest environment. That way all of the cross-compilation issues are
avoided.
PRoot can also *mix* the execution of host programs and the execution
of guest programs emulated by QEMU user-mode. This is useful to use
host equivalents of programs that are missing from the guest rootfs
and to speed up build-time by using cross-compilation tools or
CPU-independent programs, like interpreters.
It is worth noting that the guest kernel is never involved, regardless
of whether QEMU user-mode is used or not. Technically, when guest
programs perform access to system resources, PRoot translates their
requests before sending them to the host kernel. This means that
guest programs can use host resources (devices, network, ...) just as
if they were "normal" host programs.
==

Development of an Input Forwarding and Screenshowing application for linux

Hello,
We are planning to write a small application for linux that captures the Screen of an Android phone and forwards inputs from the keyboard and mouse to it.
I know there is scrcpy but it needs access to the adb shell and the mobile phone to be in the developers mode.
Are there any possibilities to achieve this without the android developer mode? An alternative we had in mind would be to additionally write a android app that streams the Screen and the Inputs via USB - are there any openSource libraries/documentation/apis we could use for that?
Thank you
Langohr

Categories

Resources