UDP Socket with Acknowlegment
my problem is with UDP Socket , I have two methods broadcastDatagram(send message to server) and ProcessPendingDatagram (receive message from server)
the problem is that the server must send an acknowlegment when he receive a message sent by a sender.
I send message in a loop instruction(for) because I have so many message to be sent. Server can't respond to all my messages, he send me an acknowlegment for only the last one.
I must prevent Sender from sending a message until he got acknowlegement from server.
I tried Sleep(ms) but it seems to block receiving message as well.
I would use a queue. Send one message, when you receive the answer (I would assume in a slot), take the following message from the queue and send it until it's empty.
Hope it helps
There is nothing in the UDP protocol to make sure packages are actually received by the intended recipient.
So what happens when a package is lost? Will you never ever talk to the server again then?
Your requirement sounds like you really want to use TCP... that makes sure no packages are lost for you and the cool thing is you get that without having to write code yourself:)
I must use UDP socket because it is a protocol specification ,in my case I send an Order (Read or modify the value of a parameter contained in the server memory) , the server must send a response (an acknowledgement to be sure that the order was received and the result of the ordre execution)
that's why I need to be sure that I receive reponse to send another Order. Sorry for my english :(
If it matters whether requests and acknowledgements are lost, then you have to implement logic to handle lost packages. That makes the whole thing a really interesting task.