Wlan home network: how can a Vb6 winsock receive data from android phone
Hello,
I want to use my smartphone to make a voice recognition
using the android app "de.simmet.thevoice".
When I speak some words in my cellphone the android app
sends some data to my PC (Windows10) where I'm running
e.g. a vb6 winsock.
I want to know what must the VB6 code be
to be able to receive data from the smartphone.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Originally Posted by vb_elmar
I want to use my smartphone to make a voice recognition using the android app "de.simmet.thevoice".
and the Windows10 PC in my home network has the ip: 192.168.1.2
Am I right when I use a VB6 winsock?
The little App you are talking about, is apparently sending the "speech-decoded Text" per http-protocol.
And thus a (socket-based) Server-Implementation should act like a WebServer (adhering to the rules of http).
If you want to make a simple fast test, you could check in a vbRichClient5-reference into an otherwise empty project -
and use the code below:
Code:
Option Explicit
Private WithEvents WebServer As cWebServer
Private Sub Form_Load()
Set WebServer = New_c.WebServer
WebServer.Listen App.Path, "192.168.1.2", 8080
End Sub
Private Sub WebServer_ProcessRequest(Request As vbRichClient5.cWebRequest)
'Print out, what's coming in... (over the URL - and also over the "Request-Body" (if there is one)
Debug.Print Request.URL
If Request.DataLen Then Debug.Print Cairo.ToBSTR(Request.GetData)
'Send out a simple Text-Response (currently always the same one, in the future depending on the incoming text)
Request.Response.SetResponseDataString "Hello World"
End Sub
The URL you should set-up in your phones little "Speach-recognition-app" would be
(according to the WebServer.Listen in the Form_Load above): "http://192.168.1.2:8080"
Olaf
Last edited by Schmidt; Feb 10th, 2018 at 04:37 PM.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Unfortunately I cannot access the webserver from my cellphone.
When entering the following URL in Firefox (the Firefox browser
installed on my Win10 PC where the vb webserver is running) http://192.168.1.2:23000/
the Firefox Browser shows the "Hello World" message.
But when entering the same URL in the Chrome browser on my cell phone,
i wait 60 seconds and then I get this message:
I turned off the firewall on my Win10 PC, but it doesn't work.
-Must I set the vbRichClient5 webserver to "Public" to access
the webserver with my mobile phone?
Unfortunately the website www.vbrichclient.com
has no forum to answer my question.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
If your PC is behind a NAT router and your phone is on the public Internet then even setting the firewall rule to permit "public" network access isn't enough. You must map the port from the Internet side of the router to your PC on the private side as discussed in some depth here just recently.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Originally Posted by dreammanor
Maybe the Chrome browser needs https instead of http.
No, it doesn't. I just tested Chrome on my phone to a program using my Gossamer web server UserControl and it works just fine using HTTP. See the CodeBank, there is no need for a gigantic 3rd party undocumented closed source library for this sort of thing.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Originally Posted by dilettante
No, it doesn't. I just tested Chrome on my phone to a program using my Gossamer web server UserControl and it works just fine using HTTP. See the CodeBank, there is no need for a gigantic 3rd party undocumented closed source library for this sort of thing.
I learned your Gossamer web server a few weeks ago and it's great. But in our country, 99% of VB6 software using Winsock will be intercepted by security software.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Yes abuse leads to restrictions unfortunately. Lots of things about VB6 raise flags as dangerous because so many script kiddies have started to use it as a malware platform.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Congratulations. Maybe I should learn one more language to understand the text in the picture above.
My PC still can't communicate with my mobile phone because I don't know how to map the port from the Internet side of the router to my PC, as dilettante said in post #6.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Originally Posted by dreammanor
Congratulations. Maybe I should learn one more language to understand the text in the picture above.
My PC still can't communicate with my mobile phone because I don't know how to map the port from the Internet side of the router to my PC, as dilettante said in post #6.
Normally (if we talk about "SmartPhone-usage at home") there is no need for that because:
- your Phone will prefer the private WLAN-connection of your router (over the Phone-Providers Radio Inet-Connection - which costs more, at least here in germany),
.. after getting a dynamic IP in your Home-Lan-IPrange from your Routers DHCP-server, automatically login in to that "Private HotSpot", when you reach home
- and the Routers are smart enough, to - well, "route" - any requests which are made to another machine in your Home-Lans IP-Range *directly* to the other machine in question (no NAT coming into play there)
.. (in that case, your Desktop-Machine, when it is listening on one of the IPs of your Home-Range (typically Class C, beginning with 192.168. or sometimes Class A or B -beginning with 10. and 172 respectively)
So it really boils down in the end, to the Desktop-PCs Network and Firewall-Settings (and as the OP found out - in case of MS's newer OSes, which "Zone" you declare a given Network-connection to be in).
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Yeah - that's what I meant with "Zone-Membership of a given Network-Conn" (the term on an english-OS in the above screen seems to be: "network-location").
Though I have no experience with "MS-HomeGroup-stuff" (for which MS seems to have "extra-special-rules")...
But when you choose,
that a given Network-Conn is a "Public Spot" (as e.g when you connect your Notebook to.the WLan-HotSpot in your preferred "side-walk cafè"),
then "stronger discoverability-rules" will apply (your Notebook is then "more isolated" from other machines on that public HotSpot).
So, when you are at home, you should give the Network-Conn to your HomeLan-Router a hint, "that you are" (on a private Lan).
BTW, does the speech-recognition work (I've no time currently to test the little "delegator-App you mentioned on my Phone).
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Originally Posted by Schmidt
Normally (if we talk about "SmartPhone-usage at home") there is no need for that because:
- your Phone will prefer the private WLAN-connection of your router (over the Phone-Providers Radio Inet-Connection - which costs more, at least here in germany),
.. after getting a dynamic IP in your Home-Lan-IPrange from your Routers DHCP-server, automatically login in to that "Private HotSpot", when you reach home
- and the Routers are smart enough, to - well, "route" - any requests which are made to another machine in your Home-Lans IP-Range *directly* to the other machine in question (no NAT coming into play there)
.. (in that case, your Desktop-Machine, when it is listening on one of the IPs of your Home-Range (typically Class C, beginning with 192.168. or sometimes Class A or B -beginning with 10. and 172 respectively)
So it really boils down in the end, to the Desktop-PCs Network and Firewall-Settings (and as the OP found out - in case of MS's newer OSes, which "Zone" you declare a given Network-connection to be in).
Olaf
Yes, now I can access my PC and get Json data from mobile browser on my home private LAN (home WiFi). Thank you so much, Olaf.
Last edited by dreammanor; Feb 14th, 2018 at 11:17 AM.
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Now we have the year 2020.
I got a new WINDOWS-10 PC. Under Project/References
my VB6 is missing vbRichClient5.dll (as shown in the picture below).
I have to see how to fix this..
EDIT (Solution): I downloaded vbRC5BaseDlls.zip (2.2MB) on vbRichClient.com and unzipped the file. Then i ran the file RegisterRC5inPlace.vbs. Now I have got the menu item vbRichClient under Project/References.
Last edited by vb_elmar; Mar 20th, 2020 at 10:48 AM.
Reason: 1 problem solution added
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
@Schmidt (Posting 2)
Thanks!
I added a small vbRichClient5
WebServer sample program.
(attachment "a4.zip" 5kB)
This is the source code of the program "a4.zip" :
Code:
'VB Program for "The Voice" android app:
Private WithEvents WebServer As cWebServer: Const nil2 = 15
Private Sub Form_Load()
Set WebServer = New_c.WebServer
WebServer.Listen App.Path, "192.168.1.11", 23000
Move nil2 * 3, nil2 * 3, Screen.Width * 0.98, Screen.Height * 0.65
End Sub
Private Sub WebServer_ProcessRequest(Request As vbRichClient5.cWebRequest)
'Request.URL contains the words you said in the microphone of your android phone :
Print Request.URL
'This is what the vb6 cWebserver answers :
Request.Response.SetResponseDataString "vb6 RichClient " & Right(Time, 2) & " seconds"
End Sub
Last edited by vb_elmar; Mar 21st, 2020 at 07:15 AM.
Reason: 1 code added
Re: Wlan home network: how can a Vb6 winsock receive data from android phone
Since the december 2019 upgrade the Windows 10 Home Group no longer exists (posting #13).
-This is the new options window to Configure Sharing Options in Windows 10:
Network discovery must be enabled for the android Application The Voice .
Last edited by vb_elmar; Mar 20th, 2020 at 01:54 PM.
Reason: added a reference to posting 13