I am trying the PJSIP on the Android and to emulate the commands on the Android, it asks us to telnet to 10.0.2.15:2323.
But when I try to telnet from my terminal it doesn't allow to telnet.
What I found was telnet localhost 5554, it works to access the emulator.
Please how can I telnet to 10.0.2.15:2323?
Just use a space instead of a : between the ip-addr and the port
telnet 10.0.2.15 2323
Make sure the adb server is running
adb start-server
Telnet to the port on which the adb server is listening (typically 5554).
telnet localhost 5554
Then on the telnet prompt, add a new redirection. The adb server will listens to an additional port 5000 and forward the traffic to the telnet service on port 2323 on the emulator.
redir add tcp:5000:2323
Now one can telnet to localhost with port 5000, adb server forwards this to the telnet server on the emulator
telnet localhost 5000
Related
I want to connect with my linux pc through ssh to my linux device which is connected via USB to my android device(Only using adb shell commands)
For now I'm doing it using two apps which is installed on my android device:
1. Network IP scanner, which gives me the IP of the target device.
2. FwdPortForwardingApp (https://github.com/elixsr/FwdPortForwardingApp)
With that App I perform port forwarding using BOTH udp and tcp protocols from wlan0 on port 2222 to the target IP I got from the network IP scanner on port 22.
I want to do it using only adb shell commands, how can I do it?
Tried adb forward tcp:2222 tcp:22 and adb reverse tcp:2222 tcp:22 which didn't help
Expected to perform ssh using port 2222 directly to my device using only adb shell commands (Cause I want to create a script which will perform all the commands together without using the android device)
So here's what I'm trying to do: I have an Android app that uses a ServerSocket and I need to connect to this socket from my computer.
I've tried to get my IP address using adb shell ifconfig and I can ping this IP from the emulator's shell but I can't ping it from my computer's terminal.
In other words, how can I use Postman to connect on my emulator's web server?
I've found the solution. It seems that if you want to communicate from your computer to your emulator, the IP address to use is 127.0.0.1 and you need to do some port forwarding using ADB in command line.
For example if you emulator is running a server on port 8080
adb forward tcp:8080 tcp:8080
Then call it with localhost:8080
After upgrading my device to Marshmallow, I am unable to connect my device on tcpip for wifi debugging (It used to work on Lollipop). IP is my device IP address.
platform-tools>adb connect IP:5555
I am getting below message
unable to connect to IP:5555
I also tried to connect on 7612 port.
5555 is the port number which is not used while connecting. Connection takes place in to steps:
Set port on which connection is to be stablished(in this case 5555)
Connect to the device using it's IP address.
So let's say your device IP is 192.168.1.1 and you want to connect over port 5555,
adb tcpip 5555
adb connect 192.168.1.1
Try the following
Make sure that Aggressive Wi-Fi to Cellular handover under Networking section in the device's developer options is turned off.
ping continuously from your pc to the device to make sure it's not in network idle mode
ping -t 192.168.1.10 (windows cmd), unlock the device and even try to surf to some
website just to make it get out of the network idle.
If ping doesn't work, turn off / on Android Wifi and go back to step 2.
When it replies to the ping, connect it via usb, and:
adb usb
adb tcpip 5555
adb connect 192.168.10.1:5555
In case it's still not connected, try to switch the usb connection mode as MTP / PTP /
Camera while the device is connected through usb and repeat these steps over again...
If the above points are not working please try running adb as admin. For Ubuntu -
sudo adb start-server
as stated here
I have a scenario where I need to start Android Emulator with a specific IP Address?
Can I start the emulator like that?
I do not want to do IP forwarding or other stuff, because there is an Android program running in the Emulator which on boot will configure itself with Android Emulators IP address present during boot time.
As by default the ip address of emulator is 10.0.2.15 which I need to change.
Also, this Ip is set in init.goldfish.rc and init.goldfish.sh.
If I change them, still the ip of android is 10.0.2.15.
I made work by this way:
In Android Emulator if you do ifconfig then you will see bridge, eth0 & eth1 as network devices. Where bridge has the 10.0.2.15 as ip and eth0 is up but without any ip and eth1 is down without any ip.
Now create a TAP and Bridge devices on you host machine and bridge your TAP device with any of the working ethernet cards on you host machine.
The TAP device (tap1) and bridging (br1) it with eth0 can be created following below steps:
$sudo ip tuntap add dev tap1 mode tap
$sudo ip link show dev tap1
$sudo brctl addbr br1
$sudo brctl addif br1 tap1
$sudo brctl addif br1 eth0
$sudo ip link set eth0 up
$sudo ip link set br1 up
$sudo brctl show
So now once your TAP is up and if your eth1 is connect to any dhcp server, start the dhcp server.
Once the dhcp server is started, run the emulator with below command:
$sudo ./emulator -avd <avd_name> -qemu -net nic,vlan=1 -net user,vlan=1,hostname=<hostname_you_want> -net nic,vlan=2,macaddr=<mac_id_of_eth1_of_android_emulator> -net tap,ifname=tap1,script=no,vlan=2
In your android emulator shell run below command:
$netcfg
You should be able to see eth1 down with ip 0.0.0.0, now run below command to bring up the eth1:
$netcfg eth1 dhcp
And voila!!! you have the eth1 with ip address assigned from dhcp server.
Let me know if it works!!!
Now if you have any program in android emulator opening port on external server ip address it would go through eth0 of host machine to the external server.
i want to learn how to mock up location in android device and develop a location based app. My problem is when I say adb shell in the command prompt it lets me go into the emulator with # symbol.
problem starts here
When I enter telnet localhost 5554 to telnet the device it says telnet: not found
what could be the problem?? am I doing something wrong?
you don't have to telnet with adb. Just use a normal command line window to type in telnet localhost 5554 - but don't enter adb before!
You don't have telnet installed.
In ubuntu install it by:
$ sudo apt-get install telnet