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. Best way to retrieve data from different servers using UDPSocket
QtWS25 Last Chance

Best way to retrieve data from different servers using UDPSocket

Scheduled Pinned Locked Moved Unsolved General and Desktop
qudpsocketmany servers
4 Posts 2 Posters 1.1k 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.
  • G Offline
    G Offline
    Gacha
    wrote on 10 Sept 2017, 09:04 last edited by Gacha 9 Oct 2017, 09:05
    #1

    Good morning,

    I'm working on a program used to display informations of many game servers (average 150).

    I thought create a class "ServerQuery" that contains contains my UDPSocket (under unique_ptr) and the functions to send and retrieve the information from one server.

    The problem is that I'm using a slots and connect, so I can't create an instance of ServerQuery class in local function.

    I thought that I can create a QList of ServerQuery attribute and for each sent I push an instance in this QList and remove it at the end of communication.

    (I just need to send and retrieve the information, after that, the socket can be closed).

    Thanks you in advance,
    Alexandre

    K 1 Reply Last reply 10 Sept 2017, 11:18
    0
    • G Gacha
      10 Sept 2017, 09:04

      Good morning,

      I'm working on a program used to display informations of many game servers (average 150).

      I thought create a class "ServerQuery" that contains contains my UDPSocket (under unique_ptr) and the functions to send and retrieve the information from one server.

      The problem is that I'm using a slots and connect, so I can't create an instance of ServerQuery class in local function.

      I thought that I can create a QList of ServerQuery attribute and for each sent I push an instance in this QList and remove it at the end of communication.

      (I just need to send and retrieve the information, after that, the socket can be closed).

      Thanks you in advance,
      Alexandre

      K Offline
      K Offline
      koahnig
      wrote on 10 Sept 2017, 11:18 last edited by
      #2

      @Gacha

      Hi and welcome to devnet forum

      Are you aware of the differences between TCP and UDP?

      Therefore, it is only your choice, if you decide also what protocols are used on the other ends as well.

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

      1 Reply Last reply
      1
      • G Offline
        G Offline
        Gacha
        wrote on 10 Sept 2017, 13:46 last edited by
        #3

        @koahnig Thanks !
        Yes I know the difference between UDP and TCP but the servers were not developed by me and it works with UDP protocol.

        Thanks for your response

        K 1 Reply Last reply 10 Sept 2017, 14:25
        0
        • G Gacha
          10 Sept 2017, 13:46

          @koahnig Thanks !
          Yes I know the difference between UDP and TCP but the servers were not developed by me and it works with UDP protocol.

          Thanks for your response

          K Offline
          K Offline
          koahnig
          wrote on 10 Sept 2017, 14:25 last edited by
          #4

          @Gacha

          I am not sure where you see the problems.

          The connections between signal and slots are removed with destruction of either object

          There is an issue when you are deleting an object when you are deleting it from the slot routine which is called an object's signal. I can imagine that there you may face a problem when using unique_ptr. To avoid this there is deleteLater()

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

          1 Reply Last reply
          0

          4/4

          10 Sept 2017, 14:25

          • Login

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