Important: Please read the Qt Code of Conduct -

Best way to retrieve data from different servers using UDPSocket

  • 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,

  • @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.

  • @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

  • @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()

Log in to reply