472,954 Members | 1,579 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

How to make UDP reliable

72
Hi,

I have implemented client server communication, I have used UDP as transport layer protocol. I am sending a file from client to server. Each time am sending 1024bytes. At receiver side am receiving those bytes and writing to a file. But as we know that UDP is unreliable, packets may arrive out of order. So how can I make all packets in order at receiver side? Is there any way to implement it? My target is to make sending file and receiving file to be identical. Please show me the way how can i implement?

Thanks,
Manjunath
Feb 13 '08 #1
7 10224
gpraghuram
1,275 Expert 1GB
Hi,

I have implemented client server communication, I have used UDP as transport layer protocol. I am sending a file from client to server. Each time am sending 1024bytes. At receiver side am receiving those bytes and writing to a file. But as we know that UDP is unreliable, packets may arrive out of order. So how can I make all packets in order at receiver side? Is there any way to implement it? My target is to make sending file and receiving file to be identical. Please show me the way how can i implement?

Thanks,
Manjunath

What you can do is with every chunk of data you send add a chunk count to it and in the receiving end you can read the data and store it in memory for some time till u get the all the chunks.
Then you can order the chunks based on the count and flush it to the file

Raghuram
Feb 13 '08 #2
sicarie
4,677 Expert Mod 4TB
My big question is why are you trying to do this? If you want a reliable protocol, use TCP. UDP is for streaming data, TCP is where you want to make sure you have everything being sent.

Easy fix: use TCP.
Feb 13 '08 #3
manjuks
72
My big question is why are you trying to do this? If you want a reliable protocol, use TCP. UDP is for streaming data, TCP is where you want to make sure you have everything being sent.

Easy fix: use TCP.
Ok thanks, But am intrusted to implemented using UDP, Its just for my curiosity to know how can we make UDP as reliable.

Thanks,
Manju
Feb 14 '08 #4
sicarie
4,677 Expert Mod 4TB
Ok thanks, But am intrusted to implemented using UDP, Its just for my curiosity to know how can we make UDP as reliable.

Thanks,
Manju
Make it like UDP? I don't understand the question. Why would you want to turn it into something that's already out there? Why not just use what's already out there?
Feb 16 '08 #5
Ok thanks, But am intrusted to implemented using UDP, Its just for my curiosity to know how can we make UDP as reliable.

Thanks,
Manju
UDP is designed for unreliable, connection less purpose, it is not like you can not make it as reliable, when you make it completely, then it becomes TCP. And also your are violating RFC. if you are violating RFC you many live in networking world.

TCP is one the more powerfull protocol in transport, so learn it , work on it, then i think you will become more curiosity on TCP.

If you have any design/technical problem by using TCP, please tell to me, we could innovate something else....

-Regards
Arul
Feb 16 '08 #6
Hi,

I have implemented client server communication, I have used UDP as transport layer protocol. I am sending a file from client to server. Each time am sending 1024bytes. At receiver side am receiving those bytes and writing to a file. But as we know that UDP is unreliable, packets may arrive out of order. So how can I make all packets in order at receiver side? Is there any way to implement it? My target is to make sending file and receiving file to be identical. Please show me the way how can i implement?

Thanks,
Manjunath
Why not add a header for every chunk of data? Normally, network protocols that can be implemented over UDP uses sequence numbers to keep track of its order.
Feb 17 '08 #7
chump
1
There's not much point in making UDP as reliable as TCP (just use TCP). However, it is frequently desireable to use UDP and assume some lost packets but still require that packets be processed in order.

An easy way to ensure packets are receive in order is to add a sequence number to your message. If the receiver has received and processed sequence # n and gets a packet with secquence # n-1, it drops it. If the receiver receives n+1, it processes it (sends it to the application).

f it receives n+2, it sticks it in a queue and then starts an interval timer. If the timer expires without getting any other messages, it assumes n+1 never made it and processes the queued packet. If n+1 arrives, it processes it and then pulls n+2 out of the queue and processes it.

The implementation details are a little more complicated, but you get the gist.

TCP has all sorts of stuff in the protocol, including ACKs, retries, flow control, etc, that would be very difficult to (re)implement with UDP. However, you could probably devise a light-weight retry mechanism (without the rest of TCP) on UDP with not much effort if your application can't handle dropped packets. You can do this by manuall sending ACKs for each packet, but then you will need to deal with duplicate packets, more timers, etc.
Feb 17 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

82
by: Peter Diedrich | last post by:
The site design is pretty simple: ============================================ | Head | ============================================ | | ...
0
by: relisoft | last post by:
Seattle, WA -- Seattle-based Reliable Software® announces the release their Windows Library into the public domain. Reliable Software Windows Library, RSWL, is the foundation for their compact,...
0
by: melledge | last post by:
The Reliable Source for Everything XML - XML 2005 Update XML 2005 - November 14-18 - Atlanta Hilton Hotel - Atlanta, GA www.xmlconference.org Register today and participate in IDEAlliance's...
2
by: Buddy Ackerman | last post by:
I seem to have a lot of complaints from users about file upload problems to my site (developed in ASP.NET). The issue is not related to setting the maxRequestLength or any security issues. Most of...
5
by: splodge | last post by:
This may seem like a stupid question but I want to check before I go ahead and build this... I am working on a portal, part of which allows users to upload files. Part of the array within...
11
by: OlafMeding | last post by:
Because of multithreading semantics, this is not reliable. This sentence is found in the Python documentation for "7.8.1 Queue Objects". This scares me! Why would Queue.qsize(), Queue.empty(...
4
by: John Grant | last post by:
If I build a web services today with VS 2005 does it support reliable messaging? If I use WSE 3.0 will it support reliable messaging? If I don’t have reliable messaging can I make a web method...
1
by: relisoft | last post by:
SEATTLE, Washington. - July 12, 2006: Reliable Software® announces the upcoming release of Code Co-op® version 5.0. Code Co-op is an affordable peer-to-peer version control system for distributed...
2
by: bshumsky06 | last post by:
Hi, I am trying to create stored procedures in MySQL. Does anyone have a suggestion on a good IDE to use. I have been working with the MySQL Query Browser but it generates errors very often and...
1
by: =?Utf-8?B?S2F1c2hhbCBNZWh0YQ==?= | last post by:
Hi, I am facing the ServerTooBusyException when using reliable session and net.tcp binding. I have single server and single client application. The client registers for the event at the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.