Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Windows - Android direct connection
Forum Update on Monday, May 27th 2025

Windows - Android direct connection

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
8 Posts 3 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tabanito
    wrote on 9 Oct 2018, 15:03 last edited by aha_1980 10 Sept 2018, 18:45
    #1

    I was wondering if there is a way to connect and exchange data between a windows Qt app and several Android devices in the same room (Wifi, Direct Wifi, maybe Bluetooth ...). The windows Qt app will play the server role and the devices will be the clients.

    I am currently exchanging data through a server (Firebase) but all the devices will be in the same room so I was wondering if there is a simpler and cheapest solution.

    Any hint?

    K 1 Reply Last reply 9 Oct 2018, 16:24
    0
    • T Tabanito
      9 Oct 2018, 15:03

      I was wondering if there is a way to connect and exchange data between a windows Qt app and several Android devices in the same room (Wifi, Direct Wifi, maybe Bluetooth ...). The windows Qt app will play the server role and the devices will be the clients.

      I am currently exchanging data through a server (Firebase) but all the devices will be in the same room so I was wondering if there is a simpler and cheapest solution.

      Any hint?

      K Offline
      K Offline
      koahnig
      wrote on 9 Oct 2018, 16:24 last edited by
      #2

      @Tabanito

      Hi and welcome to devnet forum

      With Wifi you can as soon as their IP addresses on an internal network are known you can do. You can simply establish a QTcpServer - QTcpSocket setup and exchange data as you would do with any TCP connection.

      The same seem to be possible when looking at the different options for QBlueTooth. Looks like at least a similar procedure as with TCP/IP. However, I have not done that yet.

      About direct Wifi I have no experience.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      3
      • T Offline
        T Offline
        Tabanito
        wrote on 10 Oct 2018, 00:36 last edited by
        #3

        Hi, thank you for your reply. I tried to use TCP as it is probably the better option for me.
        I am able to run a Tcp Server in Qt following the Fortune Sample in the doc. I also built an Android Tcp Client which is supposed to send messages to my c++ server.
        Well, it doesn't work, I've got to be missing something... I'm taking the IP address Ipv4 from the LAN WiFi connection with both my computer and my Android device connected to the same WiFi. Any response. I already tried like 3 custom classes that I found on the web which worked for other people.
        Did you ever achieve what I'm trying to do? Can you show me a working example? I'm developing my Android app in Android Studio.
        Thanks in advance

        K 1 Reply Last reply 10 Oct 2018, 07:23
        0
        • T Tabanito
          10 Oct 2018, 00:36

          Hi, thank you for your reply. I tried to use TCP as it is probably the better option for me.
          I am able to run a Tcp Server in Qt following the Fortune Sample in the doc. I also built an Android Tcp Client which is supposed to send messages to my c++ server.
          Well, it doesn't work, I've got to be missing something... I'm taking the IP address Ipv4 from the LAN WiFi connection with both my computer and my Android device connected to the same WiFi. Any response. I already tried like 3 custom classes that I found on the web which worked for other people.
          Did you ever achieve what I'm trying to do? Can you show me a working example? I'm developing my Android app in Android Studio.
          Thanks in advance

          K Offline
          K Offline
          koahnig
          wrote on 10 Oct 2018, 07:23 last edited by
          #4

          @Tabanito said in Windows - Android direct connection:

          Hi, thank you for your reply. I tried to use TCP as it is probably the better option for me.
          I am able to run a Tcp Server in Qt following the Fortune Sample in the doc. I also built an Android Tcp Client which is supposed to send messages to my c++ server.

          Do you use the fortune example as well?

          Well, it doesn't work, I've got to be missing something... I'm taking the IP address Ipv4 from the LAN WiFi connection with both my computer and my Android device connected to the same WiFi. Any response. I already tried like 3 custom classes that I found on the web which worked for other people.

          The option with Wifi in an internal network is probably the easiest form. First I would try toget it to work with two Windows sides working. If you have only one Windows PC, you can run both in the same machine. Certainly better to have two independent Windows PCs. I am simply using IPv4 addresses (e.g. 192.168.x.x). With a smartphone you might have the problem that for whatever reason the connection may go through the phone network, which gives you an outside connection. Besides typical AV-interferences I do not see major obstacles.

          Did you ever achieve what I'm trying to do? Can you show me a working example? I'm developing my Android app in Android Studio.

          Does that mean that you are not using Qt on Android?
          In principle that should work as well. However, I am using Qt on Windows and Android for getting the connection. Therefore also my question above about using the Fortune Client on Android.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          2
          • T Offline
            T Offline
            Tabanito
            wrote on 10 Oct 2018, 20:38 last edited by
            #5

            Hi, thanks for your reply (again). I detected my problem. After hours (maybe days) of debugging, I found out that the problem is my Windows Firewall. It is blocking my port. I want my server to disable the Firewall just for my app or my port. How can I achieve that?

            J 1 Reply Last reply 11 Oct 2018, 04:41
            0
            • T Tabanito
              10 Oct 2018, 20:38

              Hi, thanks for your reply (again). I detected my problem. After hours (maybe days) of debugging, I found out that the problem is my Windows Firewall. It is blocking my port. I want my server to disable the Firewall just for my app or my port. How can I achieve that?

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 11 Oct 2018, 04:41 last edited by
              #6

              @Tabanito Your server should not try to manipulate the firewall. For that you need administrator privileges for a good reason. So, do it on OS level.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              2
              • T Offline
                T Offline
                Tabanito
                wrote on 11 Oct 2018, 06:14 last edited by
                #7

                How can I prompt the user to disable the Firewall then? It should be an easy way

                K 1 Reply Last reply 11 Oct 2018, 08:32
                0
                • T Tabanito
                  11 Oct 2018, 06:14

                  How can I prompt the user to disable the Firewall then? It should be an easy way

                  K Offline
                  K Offline
                  koahnig
                  wrote on 11 Oct 2018, 08:32 last edited by
                  #8

                  @Tabanito

                  Probably the best is to have a note during installation or when you start up the application, in case you want to be thorough. The firewall is prevent attacks from outside in your case. Therefore you need to do it on OS level as recommended by @jsulm
                  However, it is also not possible to knowabout outside attacks and their blockage.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  1

                  1/8

                  9 Oct 2018, 15:03

                  • Login

                  • Login or register to search.
                  1 out of 8
                  • First post
                    1/8
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved