Hello,
at the beginning i would like to thank everyone worked in this great app "B4A"
finally i could make TCP connection from Android to my VB6 App. :sign0060:
it works gr8 only if i'm sending and receiving plain text
VB6 uses ANSI encoding while i use in B4A "Windows-1256" charset (to show Arabic characters)
i use custom encryption logarithm i wrote in VB6 and i could convert it to work with B4A
the problem now is : when i send encrypted string from Android to the VB App it can't decrypt it correctly
also the same when i send the string from the VB to android
how ever when i encrypt and decrypt the string from android alone it works
i know that the problem because of the encoding but i don't have any idea how to fix it
any ideas are much appreciated :sign0085:
thanks in advance
Your encryption algorithm outputs valid strings?
Create a short message, send it to the device and compare the results.
Ansi encoding can refer to several encodings. You should find the actual encoding used by your program. It depends on your Windows regional settings.
Your encryption algorithm outputs valid strings?
Create a short message, send it to the device and compare the results.
Ansi encoding can refer to several encodings. You should find the actual encoding used by your program. It depends on your Windows regional settings.
You should find the right CharSet to use. You should first find the codepage used by your VB6 program. Alternatively you can encrypt your string to a bytes array, send the bytes array and then convert the bytes array to string.
Just wondering if you would share the basics of how the link works?
I've just purchased b4a and am exited to connect a vb6 app to b4a.
I don't even know where to start as of now. Did you use the winsock component? I'd only be using plain text for example.
Attached is a little test program which I used to get communication between a VB6 program and Android going. Bytes are transfered 1 to 1. On the VB6 side I used Winsock.
Notice that I did not use the AStreams prefix mode in order to stay compatible with my VB6 server application.
Thank you very much ! This worked perfict. Now I have somewere to start.
I was able to connect the Winsock component to your app and send plain text
to vb6.
Hello again, Everything is working good on the Emulator.
Just recently I've tried the test program on two real devices and get weird results.
Winsock gets nothing and the reported ip in b4a is way off e.g. 10.37.1.3 instead of
something that should look like 192.168.10.130
Can you think of why a real device will not connect?
The IP adress 10.37.1.3 is the IP of your mobile connection. Please check if your WLAN is on. I use it though over WLAN and Mobile connection without problem.
You might have to check your router and firewall settings. The port you are using should be forwarded in the router to the computer where the VB6 server is located. Also in the Windows firewall there must be an exception for that port .
10.37.1.3 is a private IP-address!
Some telephone providers use proxy server in their network. To adress your phone it need to have a public address.
In germany, as an example, only t-mobile and vodafone provide public addresses as standard, others not or only at extra charge.
Check it out with your provider.
So I assume that this is the WLAN adress of his phone.
As long as you connect from the phone to the server - no matter if it is via WLAN or Mobile Network - it should work. When I ran at customer into that problem it was always port forwarding or firewall. Or often both.
Ok thanks guys.. Here is a bit more info.. In settings on the phone the IP is set to 192.168.x.x but the test app reports the 10.121.x.x
I am infact just trying to connect local through the router. The router has no forwarded ports.
I've verifyed that WLAN is on and working.
For instance I use eventghost on the phone. It works good. Just to throw that out there.
So the phone has two selections for networking. It looks like its selecting the 3g. How can I select the local network?
Ok more info and stuff i've tryed.
b4a bridge to a real device reports a good local 192.168.x.x address
also tried on a real device without 3g.. it reports a good local 192.168.x.x address
also i've tried different ports 81,71.. non fowarded. but if i understand correctly, on a local network I didn't think i would need to.
Still Winsock gets nothing when the Device trys to connect to it.
This same b4a app works fine on the emulator. e.g. winsock connects fine.
I've read through the server tutorial and it talks about the device accepting a
connection. I could not find any talk about the device making a connection to something like winsock.
Which program initiates the connection? The server (VB6 application) or the mobile Device? Could you describe the scenario a little more detailed?
A typical scenario would be like this:
Device sends a ConnectionRequest to the server.
Server sends an Accept to the device.
Device sends any sort of data (whatever protocol you defined) to Server.
Server responds.
I too am trying to do something of this nature but without the need of having to set a specific IP Address.
Is it possible to send files and recieve files without user intervention and find out the IP Address on both the Desktop and Device automatically. I would like the whole process automated. Therefore the user would plug in their device and the desktop application starts.
Hi Rolf,
I am using your test app.. So the Device is trying to connect to winsock.
First off the on start the device gets the devices own IP. e.g. 192.168.x.x
Then Socket1.Initialize("Socket1")
Socket1.Connect("192.168.x.x",81,5000) 'The sever im trying to connect to.
On the emulator this works as advertised. winsock accepts the connection and I am
able to send data back and forth.
Now I take the apk of the working test app and install it on a real device. The app will
report it's local ip (192.168.x.x) this is good so far. But
Now if I try to connect with the device there is no responce from vb6 winsock.
This is because the device reaches your router but not the computer that runs the VB6 program. You need to configure your router to forward the port you are using for communication to that computer.
Example:
Lets say you are using port 1001
Your router has the IP 192.168.2.1
Your server has the IP 192.168.2.100
Your device has the IP 192.168.2.123
Set a rule that forwards port 1001 to IP 192.168.2.100
Set an exception for port 1001 in the Windows firewall on your server.
(You might shortly disable the Windows firewall for testing, but I would not recommend that as a lasting solution.)