Click here to Skip to main content
15,888,320 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am sending bytes array into udp port but I dont know how to ack.

What I have tried:

I have tried to send packets to UDP server. I am receiving the same packets in the receiver. Is that mean packets are successfully sent?
Posted
Updated 22-Aug-18 3:05am

UDP is a Stateless protocol - Wikipedia[^] where you don't have any feedback.

If you need some kind of acknowledgement, it has to be implemented in the top protocol. That means you have to define such a protocol or use an existing one and implement it in code. But it is usually better to use TCP instead of UDP in such cases to avoid implementing most of the stateful features.

Quote:
I have tried to send packets to UDP server. I am receiving the same packets in the receiver. Is that mean packets are successfully sent?
It is not clear what you mean here. If the server is just echoing back the received packets to the client, it is some kind of verification / acknowledgement. But not a reliable one. A reliable verification requires that senders are maintaining a list of send packets where the packets can be identified. This applies also to the acknowledgement packets where the initial receiver is now a sender. It even gets more complicated because it is not guranteed that packets are received in order.

If you think about all this and how to implement it, you will find out that there is an existing protocol that does this already: TCP.
 
Share this answer
 
Simple, YOU DON'T!

UDP does not guarantee delivery of packets, let alone the receiver(s) getting the packets in the correct order.

UDP is typically used as a "broadcast" protocol, sending data to one or more clients where the data doesn't have to be complete for the receivers to understand it, i.e. video streaming.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900