Results 1 to 20 of 20

Thread: Wlan home network: how can a Vb6 winsock receive data from android phone

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    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.

    The default URL of the app is:
    http://myserver:8080/directory/script.php

    and the Windows10 PC in my home network has the ip:
    http://192.168.1.2

    Am I right when I use a VB6 winsock?
    Attached Images Attached Images  
    Last edited by vb_elmar; Feb 10th, 2018 at 07:13 AM.

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Quote Originally Posted by vb_elmar View Post
    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.

  3. #3
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Hi Olaf, it's really amazing. Extremely grateful.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    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:
    Name:  webserver_Screenshot.png
Views: 971
Size:  56.6 KB

    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.

  5. #5
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Maybe the Chrome browser needs https instead of http.

  6. #6
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    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.

    Just hire a programmer and be done with it.

  7. #7
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Quote Originally Posted by dreammanor View Post
    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.

  8. #8
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Quote Originally Posted by dilettante View Post
    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.

    For the same reason, I also can't use RC5.RPC

  9. #9
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    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.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    -I got it!

    I had to setup my Windows10 network configuration, as the following snapshot shows:
    Name:  win10_networkconfiguration.jpg
Views: 1181
Size:  40.2 KB

    -Now I get the "Hello World" message when entering the URL...

    http://192.168.1.2:23000/

    on my cell phone in the Chrome browser (or any other browser).
    Last edited by vb_elmar; Feb 13th, 2018 at 02:45 PM.

  11. #11
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    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.

  12. #12
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Quote Originally Posted by dreammanor View Post
    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).

    Olaf

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    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.

    Hello Schmidt, I think this is the english version:
    Name:  win10_networkconfiguration_us.jpg
Views: 935
Size:  26.5 KB

  14. #14
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,219

    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).

    Olaf

  15. #15
    PowerPoster
    Join Date
    Sep 2012
    Posts
    2,083

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Quote Originally Posted by Schmidt View Post
    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.

  16. #16

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    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.
    Attached Images Attached Images  
    Last edited by vb_elmar; Mar 20th, 2020 at 10:48 AM. Reason: 1 problem solution added

  17. #17

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    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
    Attached Files Attached Files
    Last edited by vb_elmar; Mar 21st, 2020 at 07:15 AM. Reason: 1 code added

  18. #18

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    This is a screenshot of the android app "de.simmet.thevoice" :
    Attached Images Attached Images  

  19. #19

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    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 .
    Attached Images Attached Images  
    Last edited by vb_elmar; Mar 20th, 2020 at 01:54 PM. Reason: added a reference to posting 13

  20. #20

    Thread Starter
    Lively Member
    Join Date
    Sep 2016
    Posts
    80

    Re: Wlan home network: how can a Vb6 winsock receive data from android phone

    Vb6 sample program (attached to posting #17).
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width