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. UDP client server

UDP client server

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 838 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
    supratik123
    wrote on last edited by
    #1

    I am trying to create a simple client server program for UDP protocol. I did the similar kind of thing for TCP. In TCP for connecting to server I used connecttohost() and it worked fine. But i just saw in Qt help that there is no connecttohost() for UDP. How the client connects to server then? If we use the write datagram function using the port address and IP address it will communicate with server and send the datagram. But I was confused about the establishment of connection in line with TCP. Any clarity provided will be really appreciated.

    J.HilkJ 1 Reply Last reply
    0
    • S supratik123

      I am trying to create a simple client server program for UDP protocol. I did the similar kind of thing for TCP. In TCP for connecting to server I used connecttohost() and it worked fine. But i just saw in Qt help that there is no connecttohost() for UDP. How the client connects to server then? If we use the write datagram function using the port address and IP address it will communicate with server and send the datagram. But I was confused about the establishment of connection in line with TCP. Any clarity provided will be really appreciated.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @supratik123
      that's not how UDP works.

      You don't have sever and clients, you have a network and a port where you simply send without any checks at all your datagram on. And you have "clients" listening to any and all datagrams on that port.

      No direct connect between server and client


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      S 1 Reply Last reply
      2
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        In UDP there is no concept of "connection". You just send the datagrams and forget about them.

        (Z(:^

        S 1 Reply Last reply
        4
        • J.HilkJ J.Hilk

          @supratik123
          that's not how UDP works.

          You don't have sever and clients, you have a network and a port where you simply send without any checks at all your datagram on. And you have "clients" listening to any and all datagrams on that port.

          No direct connect between server and client

          S Offline
          S Offline
          supratik123
          wrote on last edited by
          #4

          @J-Hilk Okay Thanks for the reply. I got what I was missing. I will mark it as solved

          1 Reply Last reply
          1
          • sierdzioS sierdzio

            In UDP there is no concept of "connection". You just send the datagrams and forget about them.

            S Offline
            S Offline
            supratik123
            wrote on last edited by
            #5

            @sierdzio Thanks for the clarification

            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