Solved UDP client server
-
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.
-
@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
-
In UDP there is no concept of "connection". You just send the datagrams and forget about them.
-
@J-Hilk Okay Thanks for the reply. I got what I was missing. I will mark it as solved
-
@sierdzio Thanks for the clarification