QtNetwork/QUdpSocket
-
Hi.
I am trying to make a server/client app. I have one client who send the first socket using broadcast and then the server receive the socket now I need to send a socket to the client using unicast how can I do-it if I don't have the IP of the client I only have the socket. -
Hm, you can't send socket, I think you mean "packet". You can obtain an IP and port from readDatagram() method (look in Assistant)
-
Thanks for the replay. But only one question. How I know the port which has generated the client to send the packet to the server. Because after that the server replay to the client and I need to know the port because I need to bind the socket to that port !!
-
If you write both sides, you just specify the port you want to use. Otherwise, you can scan the ports on the server for the service you want to connect with.
Servers mostly have a fixed port to connect with, regardless how many clients connect with it. -
Yep, best solution will be to have fixed port for receiving answers on your client side.