tananaev / adblib

Java ADB library
BSD 3-Clause "New" or "Revised" License
278 stars 50 forks source link

What is the destination of 'AdbStream object corresponding to the specified destination'? #15

Open emptywalker opened 3 years ago

emptywalker commented 3 years ago

I'm doubt about what is destination at AdbConnection$open(String destination) , the code:


/**
   * Opens an AdbStream object corresponding to the specified destination.
   * This routine will block until the connection completes.
   *
   * @param destination The destination to open on the target
   * @return AdbStream object corresponding to the specified destination
   * @throws UnsupportedEncodingException If the destination cannot be encoded to UTF-8
   * @throws IOException                  If the stream fails while sending the packet
   * @throws InterruptedException         If we are unable to wait for the connection to finish
   */
public AdbStream open(String destination) throws UnsupportedEncodingException, IOException, InterruptedException {

}

i don't clearly that how many the specified destination ; I want to execute adb forward tcp:$port localabstract: $remotePort, what should I set destination ? why ?

MuntashirAkon commented 2 years ago

See Local Services section in the documentation: https://android.googlesource.com/platform/system/core/+/5aa0e4241029c80617a8e98b07f7f48ab6b3a3d7/adb/SERVICES.TXT

wjj1928 commented 9 months ago

Anyone make forward work? I try adb.open("forward:tcp:1234:tcp:1234") but it report exception.

mirfatif commented 9 months ago

Anyone make forward work? I try adb.open("forward:tcp:1234:tcp:1234") but it report exception.

It should be forward:tcp:1234;tcp:1234. Note the semicolon separator. Reference

wjj1928 commented 9 months ago

Changed that but still the same:

02-08 10:08:44.311 16802 16890 I MyExam  : forward:tcp:1234;tcp:1234
02-08 10:08:44.329 16802 16890 E AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
02-08 10:08:44.329 16802 16890 E AndroidRuntime: Process: com.sample.atest, PID: 16802
02-08 10:08:44.329 16802 16890 E AndroidRuntime: java.lang.RuntimeException: java.net.ConnectException: Stream open actively rejected by remote peer
02-08 10:08:44.329 16802 16890 E AndroidRuntime:    at com.sample.atest.Adb$1.run(Adb.java:100)
zwc456baby commented 4 weeks ago

Changed that but still the same:

02-08 10:08:44.311 16802 16890 I MyExam  : forward:tcp:1234;tcp:1234
02-08 10:08:44.329 16802 16890 E AndroidRuntime: FATAL EXCEPTION: pool-2-thread-1
02-08 10:08:44.329 16802 16890 E AndroidRuntime: Process: com.sample.atest, PID: 16802
02-08 10:08:44.329 16802 16890 E AndroidRuntime: java.lang.RuntimeException: java.net.ConnectException: Stream open actively rejected by remote peer
02-08 10:08:44.329 16802 16890 E AndroidRuntime:  at com.sample.atest.Adb$1.run(Adb.java:100)

Is this solved?