Use adb forward instead of redir

Go To StackoverFlow.com

0

I have a client and a server app on Android (that uses ZeroC - Ice platform for communication). Server listens on TCP port 10000 and client uses TCP port 5501 (arbitrary port numbers I have chosen).

When I telnet to server and run redir add tcp:5501 tcp:10000 it works smooth.

However, due to my current system setup (using androidx86 binary through a virtual machine), I can no longer telnet to the server. So I was hoping I could use adb forward instead. However, whatever port combination I tried, I couldn't get it to work.

I would really appreciate if someone could shed some light on these: - Is it possible to telnet to a device replicate or device? I've read on another post on stackoverflow that telnet interface is only available for emulator - What is the difference between redir and adb forward? How should I use adb forwarding to achieve redir tcp:A:B on server?

Thanks

2012-04-04 01:53
by Ege Akpinar


0

I've finally managed to get it to work. Several comments

  • USB connected devices cannot be reached via ethernet. They can be reached via wireless network (assuming they are connected to the same network with the other party)
  • VirtualBox has its own NAT forwarding. Without port forwarding, under default networking configuration (which is NAT), the virtual device is inaccesible.

My working setup is as follows

  • A USB-connected device connects to the PC via wireless (Find out your PC's local IP address, which is often something like 192.168.1.x)
  • I have enabled VirtualBox forwarding for NAT. My option is TCP 10000:10000 (where 10000 is an arbitrary port number. Note that it should be higher than 1024) So when my USB-connected device connects to the PC at port 10000, it is forwarded to the virtual device via VirtualBox's forwarding.
  • Virtual device listens to TCP port 10000. (I didn't specify host address to make life easier)
  • If you get a 'NetworkOnMainThread' exception, use

    StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
    StrictMode.setThreadPolicy(policy);
    

Hope this helps someone

2012-04-07 21:32
by Ege Akpinar