Android Question any B4a bridge module but acting as a client (connecting with VB6 server)

mbatgr

Active Member
Licensed User
Longtime User
Hi,
I'm using a simple server code on B4a to connect the tablet as a client with a pc server.

Socket1.Initialize("Socket1")
Socket1.Connect(ServerIp,port,1000)
If Connected = True Then AStreams.Initialize(Socket1.InputStream,Socket1.OutputStream,"Astreams")

Is there any better and more safe way to do that, something like B4a-bridge but acting as a client?
I appreciate any help
thank you
mike
 

mbatgr

Active Member
Licensed User
Longtime User
well, let me tell you my little story.
Before this weekend I have tested successfully my little PCserver - Tabletclient application on my work, connections established well and the the whole application workes well a couple of times in real life conditions...
During the weekend, I decided to upgrade the B4A version. On Monday's work test, was impossible to establish the PC-Tablet wi-fi connection without been able to explain the reason. The clerk said that have changed nothing on his desk and router configuration. I returned back and tested on my home network, all things went fine! My security options on my home network was WPA while at work's network was WPA/WPA2 PSK. I thought that this was the problem, but the clerk still insists that nothing has changed, and the application, before the weekend, was working properly on the same router settings, that is, WPA/WPA2 PSK. Anyway, today I went on my work, changed the router security settings to WPA but still no luck. In all situations all the machines (PC, tablets, phones) were always able to connect on the work's Wi-Fi network. Finally, I did it work but without any encryption. Could you think any reason beyond the case of something happened wrong with the upgrade from 3.8 to 4? I have the ESET security and whenever there is a connection request, I would be able to check the connection and allow it. During the problems described has never get any request from tabletclient to PCserver.
Regards,
mike b
 
Upvote 0

mbatgr

Active Member
Licensed User
Longtime User
I have developed the application to work as a server able to accept connections from more than one tablet. Also, the application is at the final phase and ready to be launched to the market but it would be akward to be able to work only with no secured wi-fi networks.
 
Upvote 0

mbatgr

Active Member
Licensed User
Longtime User
This is how I handle the server_connected event. Also, I observe that a difference is that now I use the android libraries platform
version 19.0 and I think that in the past I compiled it using 17.0 sdk platform.
(can't remember the code for publishing code in ordder the code to be clear, sorry Erel)

Sub Socket1_Connected(Connected As Boolean)As Boolean
Log(LastException)
If Connected = True Then
btnConnect.Text = "Disconnect": btnConnect.Visible=False:txtServerIp.visible=False:QuestNumber.Visible=True:lblAbout.Visible=Fals
AStreams.Initialize(Socket1.InputStream,Socket1.OutputStream,"Astreams")

GetDevicePhysicalSize
SendData("=" & DeviceLongString) ' sending device info
lvLog.Add(DeviceLongString & " connected at " & DateTime.Time(DateTime.Now))
StartExchangeInfo
Else
ToastMessageShow("Server not available",True): btnConnect.Visible=True::txtServerIp.visible=True:QuestNumber.Visible=False
whlCustom.Show(txtServerIp, txtServerIp.Text) 'show IP Wheel (again)

End If

End Sub
</p
 
Last edited:
Upvote 0

mbatgr

Active Member
Licensed User
Longtime User
It doesn't matter which version of Android SDK you use.

Your code is correct. If you are unable to connect then there is a network issue somewhere.
thank you Erel, appreciate your clarifications about...
 
Upvote 0
Top