Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to implement managment (opening/closing) of the internet connection on local PCs (LAN)?
QtWS25 Last Chance

How to implement managment (opening/closing) of the internet connection on local PCs (LAN)?

Scheduled Pinned Locked Moved General and Desktop
12 Posts 2 Posters 5.8k 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.
  • S Offline
    S Offline
    sopchek
    wrote on last edited by
    #1

    Hi.

    I have problems adding function that controls sharing the Internet connection over the LAN PCs. Tried few ways:

    • Over QNetworkConfigurationManager + QNetworkSession, finding local machine by mac address;
    • Over two separated programs (server and client), just using QTcpServer and QTcpSocket;
      Got stuck. Did I miss something? Need only 3 slots: OpenInternetConnection, CheckStatus, CloseInternetConnection.

    Sorry for nooby-dooby :D

    Appreciation guaranteed!

    1 Reply Last reply
    0
    • B Offline
      B Offline
      blex
      wrote on last edited by
      #2

      [quote author="sopchek" date="1290367439"]I have problems adding function that controls sharing the Internet connection over the LAN PCs.[/quote]

      Please provide more details what exactly you want to do. Currently I can think about 2 different tasks:

      You host works like a gateway to the Internet. You are trying to manage from you application the gateway settings: turn Internet access on and off

      You just want to connect to some address in the Internet


      Oleksiy Balabay

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sopchek
        wrote on last edited by
        #3

        [quote author="blex" date="1290404630"]

        Please provide more details what exactly you want to do. Currently I can think about 2 different tasks:

        You host works like a gateway to the Internet. You are trying to manage from you application the gateway settings: turn Internet access on and off

        You just want to connect to some address in the Internet

        [/quote]

        Hi, blex.

        Yes, I want a gateway to the Internet. It might be one app or it might be two separate server and client. What can you advice?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          blex
          wrote on last edited by
          #4

          I am still not sure that I understand the question correctly.

          If you want to configure the PC as a gateway then just do that. Use existing solutions: configure NAT or setup proxy.

          If you want to control the gateway settings then one possible solution is to run external command. On Linux that command requires root access, and it will be some issue how to send password to it. If you faced this issue just google for the solution - I do not remember it, but DejaGnu provides this possibility.

          If you want to develop your own proxy server analog then look for existing open-source implementation, it definitely available.

          Let me know if I do not answer your question.


          Oleksiy Balabay

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sopchek
            wrote on last edited by
            #5

            Hi,

            ok, look. I am about to write some client-server app. Here is kind of topology <a href="http://files.gw.kz/4btjfsjj9r.html">schema</a> of the target network. The application which will run on the local server should have an ability to control the Internet connection on the client machines over my client app installed on them. Local clients should only have an ability to connect to the Internet with the client application running on their machines, and also it will be a way of getting the status information about the server. That is the idea.

            Appreciate your help.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blex
              wrote on last edited by
              #6

              Cannot download schema - too slow speed, I got disconnected


              Oleksiy Balabay

              1 Reply Last reply
              0
              • S Offline
                S Offline
                sopchek
                wrote on last edited by
                #7

                here, try this http://www.FreeUploadShare.com/DOWNLOAD/e93ea513/schema.JPG

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  blex
                  wrote on last edited by
                  #8
                  1. Good idea to control server status. If I were you then I would use ping to do this from the client application. But maybe you should get additional info from server - in this case follow your way, but try to reduce network traffic, the network looks quite large.

                  2. Internet access control. It seems like not Qt task. Maybe it will be simpler to setup proxy server and just control it's configuration from the Qt app (allowed IP, port, protocol etc.)


                  Oleksiy Balabay

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sopchek
                    wrote on last edited by
                    #9

                    [quote author="blex" date="1291132659"]1. Good idea to control server status. If I were you then I would use ping to do this from the client application. But maybe you should get additional info from server - in this case follow your way, but try to reduce network traffic, the network looks quite large.
                    [/quote]
                    Yes, the client should not only ping the server. To reduce the traffic I want to use a digit-coded server query transfered packages, such as for example "01" is server uptime, "02" is on-line clients list, etc. How do you think of that?[quote author="blex" date="1291132659"]
                    2. Internet access control. It seems like not Qt task. Maybe it will be simpler to setup proxy server and just control it's configuration from the Qt app (allowed IP, port, protocol etc.)
                    [/quote]Indeed, but how about using QNetworkProxy class from within the running server app?

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      blex
                      wrote on last edited by
                      #10

                      [quote author="sopchek" date="1291145778"]
                      To reduce the traffic I want to use a digit-coded server query transfered packages, such as for example "01" is server uptime, "02" is on-line clients list, etc. How do you think of that?[/quote]

                      Any frequently issued request may increase network load. TCP packets contains not only data fields but also headers for TCP, IP, Ethernet etc. protocols. So, no large difference between "01" request and "IsServerRunning" request.

                      Maybe it is not a time for optimization jet but think about the following:

                      • rarely issued requests are usual TCP connections
                      • server status is broadcast (multicast) UDP packet issued by the server. It may contain not only "I am alive" information but any useful (in Ethernet max. packet size is about 1500 bytes, WiFi - do not know)

                      Oleksiy Balabay

                      1 Reply Last reply
                      0
                      • B Offline
                        B Offline
                        blex
                        wrote on last edited by
                        #11

                        [quote author="sopchek" date="1291145778"]Indeed, but how about using QNetworkProxy class from within the running server app?[/quote]

                        Maybe I am completely wrong but it seems to me that QNetworkProxy is the Client-side class that enables the application to connect to Internet using proxy. It should be used in the client applications.

                        You own implementation of the proxy server is not a simple task (also from the network performance point of view), so I suggest to use existing proxy implementation.


                        Oleksiy Balabay

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          sopchek
                          wrote on last edited by
                          #12

                          Great! Thank you so much. Now I finally find out how it suppose to be made.

                          1 Reply Last reply
                          0

                          • Login

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