The synchronization issue on sending and receiving data via UDP Multicast...
-
Hi, there... I’m now getting a problem: In my current Winsock2-based application, I need to deliver lots of data from the Server side to more Client sides via the UDP multicast mode. However, one or more Client sides cannot receive some data blocks sometimes After a hard debug process, I found the program is: the Server multicasts the data too fast, and the Client cannot receive all the sent blocks of data in time, i.e., the process speed of Client is more slower than the Server, some block of data is overcastted by the next block before the Client gets it At this time, to avoid this, I delay some time using the Sleep API after each block of data sent on the Server side. Though that’s not a best way, it works. But another program brings out – It’s hard to know how long I exactly delay: if the delay is too long, the more unnecessary time used to deliver; if it’s too short, some Clients may still lost some blocks of – It’s just hard to control the delay time after each block of data sent Does anyone can tell me another better way to synchronize the speed of sending and receiving data on both Server side and Client sides? Thanks!
-
Hi, there... I’m now getting a problem: In my current Winsock2-based application, I need to deliver lots of data from the Server side to more Client sides via the UDP multicast mode. However, one or more Client sides cannot receive some data blocks sometimes After a hard debug process, I found the program is: the Server multicasts the data too fast, and the Client cannot receive all the sent blocks of data in time, i.e., the process speed of Client is more slower than the Server, some block of data is overcastted by the next block before the Client gets it At this time, to avoid this, I delay some time using the Sleep API after each block of data sent on the Server side. Though that’s not a best way, it works. But another program brings out – It’s hard to know how long I exactly delay: if the delay is too long, the more unnecessary time used to deliver; if it’s too short, some Clients may still lost some blocks of – It’s just hard to control the delay time after each block of data sent Does anyone can tell me another better way to synchronize the speed of sending and receiving data on both Server side and Client sides? Thanks!
UDP is a poor choice if this is critical data. There is no way to predict how long it will take for some clients to receive the data because, by definiton, UDP makes no guaranteee that any of them will. It's strictly a "best effort" protocol - fire and forget. You could require a response from each client after each packet, but even that doesn't guarantee that you'll get reliable transport; some of the responses may also get lost. You could also require an acknowledgement from each client and analyze the round trip time to adjust your timer value - it might help. TCP is designed to overcome this problem, though, and would be your best choice. "Your village called -
They're missing their idiot." -
Hi, there... I’m now getting a problem: In my current Winsock2-based application, I need to deliver lots of data from the Server side to more Client sides via the UDP multicast mode. However, one or more Client sides cannot receive some data blocks sometimes After a hard debug process, I found the program is: the Server multicasts the data too fast, and the Client cannot receive all the sent blocks of data in time, i.e., the process speed of Client is more slower than the Server, some block of data is overcastted by the next block before the Client gets it At this time, to avoid this, I delay some time using the Sleep API after each block of data sent on the Server side. Though that’s not a best way, it works. But another program brings out – It’s hard to know how long I exactly delay: if the delay is too long, the more unnecessary time used to deliver; if it’s too short, some Clients may still lost some blocks of – It’s just hard to control the delay time after each block of data sent Does anyone can tell me another better way to synchronize the speed of sending and receiving data on both Server side and Client sides? Thanks!
Agree fully with what Roger said. If you find yourself having to re-invent synchronisation and error checking as part of using UDP, then you might as well use TCP - thats what it provides. If, however, you really do need to use UDP then I suggest taking a look at what other people have done. I cant remember anything off the top of my head other than mbone, but I recall their being several projects on Sourceforge relating to broadcasting video and such like. These people will need to have dealt with the same problems as you, so it's worth taking a look.
-
Hi, there... I’m now getting a problem: In my current Winsock2-based application, I need to deliver lots of data from the Server side to more Client sides via the UDP multicast mode. However, one or more Client sides cannot receive some data blocks sometimes After a hard debug process, I found the program is: the Server multicasts the data too fast, and the Client cannot receive all the sent blocks of data in time, i.e., the process speed of Client is more slower than the Server, some block of data is overcastted by the next block before the Client gets it At this time, to avoid this, I delay some time using the Sleep API after each block of data sent on the Server side. Though that’s not a best way, it works. But another program brings out – It’s hard to know how long I exactly delay: if the delay is too long, the more unnecessary time used to deliver; if it’s too short, some Clients may still lost some blocks of – It’s just hard to control the delay time after each block of data sent Does anyone can tell me another better way to synchronize the speed of sending and receiving data on both Server side and Client sides? Thanks!
Well, big thanks to Roger and Johnny... :) Now, I'm searching something useful on SourceForge.net...
-
Hi, there... I’m now getting a problem: In my current Winsock2-based application, I need to deliver lots of data from the Server side to more Client sides via the UDP multicast mode. However, one or more Client sides cannot receive some data blocks sometimes After a hard debug process, I found the program is: the Server multicasts the data too fast, and the Client cannot receive all the sent blocks of data in time, i.e., the process speed of Client is more slower than the Server, some block of data is overcastted by the next block before the Client gets it At this time, to avoid this, I delay some time using the Sleep API after each block of data sent on the Server side. Though that’s not a best way, it works. But another program brings out – It’s hard to know how long I exactly delay: if the delay is too long, the more unnecessary time used to deliver; if it’s too short, some Clients may still lost some blocks of – It’s just hard to control the delay time after each block of data sent Does anyone can tell me another better way to synchronize the speed of sending and receiving data on both Server side and Client sides? Thanks!
You could look at Real Time Protocol[^].