Re: Deaf CAsyncSocket on Windows Service.



Note that for UDP, your network stack is free to discard, at any time, for any reason
whatsoever, any UDP packet. Any router, anywhere along the path, is free to drop a packet
with no notification to sender or receiver. Therefore, if you think there is a 1:1
correlation between UDP packets sent and UDP packets received, you are in serious trouble.
There is NO SUCH REQUIREMENT. In fact, if I send UDP packets A, B and C in that order,
ANY of the following sequences are VALID as defined by the UDP protocol:

{} {A, B, C} {A C B} {B A C} {B C A} {C A B} {C, B, A} {A} {B} {C} {A B} {A C} {B A} {B
C} {C A} {C B} {A A A B B} {A B A C A B A} ...(sorry, it is an infinite set and I'm not
going to type out each one)

To believe anything else is delusional. UDP does not guarantee delivery, does not
guarantee order of delivery, and does not guarantee that you will not receive duplicate
messages. Messages are limited to 512 bytes of data (536 bytes total, including IP
datagram header). If you do a receive of fewer bytes than the UDP message, the remainder
of the UDP message can legitimately be discarded. A UDP message longer than 536 total
bytes can be truncated without any notification that it has been truncated. Often a UDP
packet will be truncated to the MTU size of the underlying transmission mechanism, that
is, 1518 bytes (including header) on Ethernet, Some other layers have shorter MTUs.
Therefore, some people have been able to send longer-than-512-byte data packets between
two machines on their desktop, but as soon as the packet hits a router it is truncated. A
change in a network card can change this. The only guarantee is that a packet will not be
truncated below 536 total bytes, but you still don't have a guarantee that the packet will
get there, get there in order, or get there only once.

UDP can ONLY effectively be used for multicasting and broadcasting, very rare and limited
situations. UDP packets are often blocked by firewalls as a policy decision by a
sysadmin. UDP has no flow control built in, and you can flood networks and routers with
UDP packets and they will merely be discarded upon receipt (it is a form of
Denial-of-service attacks). UDP is almost always a poor choice for communication.

Therefore, if you want reliability, you must not use UDP.
joe
On Mon, 19 Jan 2009 20:51:47 -0800, Tim Roberts <timr@xxxxxxxxx> wrote:

"Ricardo Vazquez" <rvazquez@xxxxxxxxx> wrote:

This is my problem:
On an application of mine, which is a Windows Service, developed with VC++
6.0, I use an UDP CAsyncSocket derived class.
...
What I do then is to programmatically restart the service; but some
datagrams have been lost. And this is a major problem for me.

Well, then you are already screwed. UDP does not guarantee delivery. You
could lose datagrams at any time, without notice.
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: tcludp - bug when closing 1-of-2 listening ports
    ... I'd say something like a zero-length UDP packet... ... It is indeed linked with zero-sized UDP packets. ... % puts -nonewline $s titi ... The zero-sized packet wreaks havoc in tcludp only if it comes on ...
    (comp.lang.tcl)
  • Re: receive delay
    ... UDP packets are used for new mail notifications, or in this case to notify ... the client is requesting the update instead of the server sending a UDP ... right of outlook, also under E-mail accounts the Use Cached mode is ... Something is blocking UDP packets. ...
    (microsoft.public.exchange.admin)
  • blocking for multiple sources
    ... One of my other threads' job is to queue up UDP packets for the main ... But occasionally I may need to have the main thread send a pulse to the ... with a timeout using select, ...
    (comp.os.qnx)
  • HTTPS Tunnel: how-to write...
    ... Our UDP packets are audio and video. ... Is a HTTPTunnel a solution that will enable us to send UDP to and ... server over port 80/433? ...
    (microsoft.public.win32.programmer.networks)
  • Re: DShow Network Receiver-Saving to File
    ... there is no guarantee that data will be delivered. ... We have a requirement to input MPEG2 TS UDP. ... when just rendering the incoming UPD MPEG2 Transport Stream. ... layer on top of UDP to deal with the reliability issues, ...
    (microsoft.public.win32.programmer.directx.video)

Quantcast