• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Implementing UDP client/server application with some reliablity by adding sequence number

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was trying to implement a Client Server Udp socket application with some reliability by adding a sequence number to each sent byte, The sequence number shall have 2 bytes from the sent datagram packet so
Could you help me out how to implement this case!!!
 
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is TCP not an option? Making UDP reliable while maintaining its benefits over TCP in terms of simplicity and real-time delivery isn't exactly trivial.
 
sopranos mamo
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Jelle Klap,

Yes you are right!!! But I had to implement a lot of reliability stuffs over UDP for the sake of mini project.
So i would appreciate if you give me a hint because last time i was able to develop a client server application using UDP sockets which calculates InternetChecksum , and it was fun.

Thanks
 
author
Posts: 23840
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Jelle Klap wrote:Is TCP not an option? Making UDP reliable while maintaining its benefits over TCP in terms of simplicity and real-time delivery isn't exactly trivial.



IMO, the main advantage of putting a reliable protocol on top of UDP, is that UDP is capable of running on a multicast group. This means that you get the advantages of TCP, with the network hardware support for fan out.

This is also why many messaging systems implement a reliable multicast transport.


sopranos mamo wrote:
Yes you are right!!! But I had to implement a lot of reliability stuffs over UDP for the sake of mini project.
So i would appreciate if you give me a hint because last time i was able to develop a client server application using UDP sockets which calculates InternetChecksum , and it was fun.



First, with UDP, it is only non-reliable at the packet level -- meaning whole packets can be lost. So, this means that you only need to put a sequence number on the packet.


The two functionality that you need to implement are gap detection and gap fill. Gap detection is easy. if you get a packet whose sequence number is higher than the one you expected, then you have a gap that you need to fill. Gap fill is a bit harder, you need to have your source keep old packets, and you need your target to request retransmission to fill the gap. This means that your sender is really a service -- as it needs to service request for retransmission.

Other things to note. It is possible for UDP to transmit out of order, so a gap that is detected may fill automatically without a request. It is possible, assuming you are over multicast, for one target to get the packet, but another to lose it, so you need to write your target to toss duplicate packets.

There are likely a few other concerns, but this should be enough to get you started.

Henry


 
What's that smell? Hey, sniff this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!