UDP data loss??

M

mike chen

i have a UDP server running windows2K
which listenning on a UDP port
and
there are about 200 clients (windows2K too),
which will send data to the server through UDP
almost at the same time.
both server and client programs are written with VC/6.0.
they work fine when the message data is small
(under 20 bytes)
while
i found only about 70-80 messages the server will receive
(loss about 120+ client messages)
when the data is longer(about 120 bytes)
the log shows the clients have sent the data
with no error!!
and
server did not receive them
is there any limitation on UDP??
how to avoid them with UDP??
anybody can help me??

pls advice

many thanks in advanced
 
D

David Robbins

mike chen said:
i have a UDP server running windows2K
which listenning on a UDP port
and
there are about 200 clients (windows2K too),
which will send data to the server through UDP
almost at the same time.
both server and client programs are written with VC/6.0.
they work fine when the message data is small
(under 20 bytes)
while
i found only about 70-80 messages the server will receive
(loss about 120+ client messages)
when the data is longer(about 120 bytes)
the log shows the clients have sent the data
with no error!!
and
server did not receive them
is there any limitation on UDP??
how to avoid them with UDP??
anybody can help me??

pls advice

many thanks in advanced

that is a 'feature' of udp. with udp there is no acknowledgement/retry
mechanism built into the protocol like there is with tcp. udp is a simple
broadcast, when sending a udp data packet the sender just addresses it and
sends it on its way, it doesn't care if it ever gets where it is going. so
yes, data loss is common and unavoidable.

there are 2 ways to fix this. the server has to know what is coming and
when it doesn't get it then it must request the client to send again (or
vice versa). but that type of handshake is up to the application to do. so
you would have to add something to your program to keep track of who has
sent data and who hasn't and go back to get it again. or you could have the
server send back and ack for each machine it receives from and have the
clients keep repeating their data until they get an ack back.

the other fix is to change to tcp.
 
M

mike chen

that is a 'feature' of udp. with udp there is no acknowledgement/retry
mechanism built into the protocol like there is with tcp. udp is a simple
broadcast, when sending a udp data packet the sender just addresses it and
sends it on its way, it doesn't care if it ever gets where it is going. so
yes, data loss is common and unavoidable.

there are 2 ways to fix this. the server has to know what is coming and
when it doesn't get it then it must request the client to send again (or
vice versa). but that type of handshake is up to the application to do. so
you would have to add something to your program to keep track of who has
sent data and who hasn't and go back to get it again. or you could have the
server send back and ack for each machine it receives from and have the
clients keep repeating their data until they get an ack back.

the other fix is to change to tcp.


.

thanks first.

and

this is what i think, too

so

what size is the UDP buffer??

and

how to tune the size in windows2K??

mike chen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top