Re: Losing UDP packets with MFC Sockets



Hi AliR,

This is the process to retrieving data from socket's buffer:

1.- After OnReceive method, a call to ReceiveFrom method is done.

2.- A CByteArray object is creating with 'new' with data received from buffer.

3.- The CByteArray is passed to an internal list of the socket class which
is later accesed by other classes.

4.- The process ends after sending a Windows' message to the respective
class to indicate the packet arrival.

As you can see, we always try to avoid being excesive time in the OnReceive
method. We will try to introduce threads in the process in order to solve the
problem.

Thanks

Vicent

"AliR" wrote:

> This might have to do with the way you are handeling your message retrieval
> from the receive buffer, are you handeling receiving multiple message in a
> single read?
>
> AliR.
>
> "Vicent Soler" <VicentSoler@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> news:3AAE5247-76AB-43A3-912A-61177FAA3A49@xxxxxxxxxxxxxxxx
> > Responses below....
> >
> > "Michael K. O'Neill" wrote:
> >
> > > Please give us some more information about your UDP usage (e.g., packet
> > > size, frequency etc). IIRC, CPU load is not the main culprit in UDP
> packet
> > > loss; rather, it's network load.
> >
> >
> > The UDP packet size is variable but usually it can be around 50-300 bytes.
> > The frequency is also difficult to calculate because the UDP Server send
> > messages using event triggers. As far as we could understand, the main
> > problem is when the UDP Client is using lot of CPT time. Then it seems
> that
> > the input buffer is being overload and packets are being discarded.
> >
> >
> > > The usual way to reduce UDP packet loss is to favor smaller and more
> > > frequent packets over larger and infrequent packets. It is often said
> that
> > > packets around the size of the MTU are best. Also, reduce the send
> buffer
> > > size and increase the receive buffer size.
> > >
> > > Mike
> > >
> > >
> > > "Vicent Soler" <VicentSoler@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > > news:9758AB39-50C0-4750-8F48-2F5399232EEA@xxxxxxxxxxxxxxxx
> > > > Hi all,
> > > >
> > > > We are developing a tool which uses UDP packets to receive data from a
> UDP
> > > > Server. The problem we have found is that some UDP packets are being
> lost
> > > > when the PC's CPU is near 100% and we think that this problem is
> related
> > > to
> > > > the Window's input buffer.
> > > >
> > > > Any suggestion to solve this problem!! Is there any way to change the
> > > input
> > > > buffer size of the socket and store the received packet while the PC
> is
> > > > processing other data? Should we use threads to extract data from
> sockets?
> > > >
> > > > We are really worried about this problem because we can not lose so
> much
> > > > packets as we do.
> > > >
> > > > Using more than one port, cuould solve the problem?
> > > >
> > > > Thanks in advance,
> > > >
> > > > Vicent
> > >
> > >
> > >
>
>
>
.



Relevant Pages

  • Re: Multiple PDUs in UDP Packet?
    ... >> Is it ok to send multiple Protocol Data Units in one UDP packet? ... >> a buffer and then send the entire buffer with one call to sendto? ... But with UDP this will not work ...
    (comp.unix.programmer)
  • Re: Variable Length Packets
    ... >> If you're using UDP, the behavior if your buffer isn't big enough ... Some implementations will return the rest of the ... How does the application determine packet boundaries ... and make your buffer big enough. ...
    (comp.unix.programmer)
  • Re: Interesting TCP behaviour with large sends/small buffers
    ... My current workaround is simply setting the send buffer to a larger ... The server, upon connection, sends a configurable number of bytes to ... packet before sending the next packet. ... ACK, according to the delayed ACK algorithm - 50KB bytes means 34 MSS- ...
    (microsoft.public.win32.programmer.networks)
  • Re: Interesting TCP behaviour with large sends/small buffers
    ... The server, upon connection, sends a configurable number of bytes to ... I set the client's receive buffer size to 1MBps, ... packet before sending the next packet. ... ACK, according to the delayed ACK algorithm - 50KB bytes means 34 MSS- ...
    (microsoft.public.win32.programmer.networks)
  • Re: Fundamentals question, is this how it works?
    ... You maintain a buffer for the last incomplete packet. ... receiving that many bytes i then break and wait for the next set of data ... With a tcp stream socket what happens when it is reading say 4000bytes ...
    (microsoft.public.win32.programmer.networks)

Quantcast