How to xfer data using USB only?

JohnC

Expert
Licensed User
Longtime User
There is an excellent android syncing app called Android-Sync (Android-Sync | Sync Android with Outlook via USB), and it allow syncing of contacts and appointments between my device and my desktop microsoft outlook app.

And for security reasons, it does this syncing over just the direct-connect USB port, with NO Wifi or Bluetooth.

It definately uses ADB to connect my desktop PC to the device, but does anyone know how is it transferring data from my desktop PC to the device without using wifi or bluetooth?

Or another question may be this - does connecting my desktop with my device using adb create some type of "network" connection over the USB cable, so that I would be able to use sockets to xfer data back and forth without using wifi?
 

JohnC

Expert
Licensed User
Longtime User
Yes.

After some more googling I found that if I first do a dos shell of "adb.exe forward tcp:2222 tcp:2222", and then write a VB6 app that sets the winsock control's "RemotePort" to 2222 (the devices port) and the "LocalPort" to 0. I was able to connect and send stuff back and forth between a desktop VB6 app and a B4A android/device app.

The only remaining issue I am running into is converting the text messages to some common format (like ANSI) because the desktop VB6 app is receiving garbled characters from the device, and when I send something to the device from VB6 app, it crashes the test B4A app. UPDATE: I was having a problem generating the correct 4-byte size "prefix" from the VB6 app, so I just initialized the astream in the b4a app w/o prefix and can now send messages back and forth with no problems.
 
Last edited:
Upvote 0

KiloOne

Member
Licensed User
Longtime User
UPDATE: I was having a problem generating the correct 4-byte size "prefix" from the VB6 app, so I just initialized the astream in the b4a app w/o prefix and can now send messages back and forth with no problems.

John,

I would like to do what you have done to communicate between a VB6 app and a b4a app.

I do not understand what sample code (AdbTest?) I need to start with as the b4a app whose 'astream' needs to be set to w/o prefix.

Can you provide a little more info on this? Perhaps your code and/or code changes?

I have set up my vb6 app as you state but how do I 'connect' winsock to b4a data?

Thanks,
Dale
 
Upvote 0
Top