1

I am trying to establish socket connection between pc and android using only usb(without wifi).I run the command in pc:

    adb forward tcp:5000 tcp:9000

I write client code on pc(bind a client socket to port 5000),and I write sever code on android(bind a ServerSocket object to port 9000 and wait for request).I wonder if there's a way to set pc as the server and android as client.I have noticed that adb will occupy port 5000 on pc, so I can't write server code to listen on port 5000.

Is there any way to establish such socket connection(pc as server,android as client) using only usb?(Is adb forward a good choice here ?)

programforjoy
  • 391
  • 3
  • 12
  • yes , you can set pc as server. You can Change the port of your client socket to some other. If you are connect with the same wifi/lan then you can access your pc . – rushank shah Aug 30 '16 at 13:14
  • http://stackoverflow.com/questions/2604727/how-can-i-connect-to-android-with-adb-over-tcp, see if this is helpful. – David Aug 30 '16 at 13:14

0 Answers0