> I used Ethereal for viewing the incoming data, and all (or at least most
of)
> the UDP packets was received according to Ethereal,

Sending UDP packets never fails.

> but my program was unable to capture them.

There is no flow control with UDP protocol. So when packets are comming, the
LAN card receive the packets (assuming some network device has not already
dropped the packet) and trigger an interrupt fo rthe OS which is translated
to an event for your program. Your program then call receive and get the
packet. This take some time to have your program read and process the data.
During this time, the LAN card receive the next packets and fill his buffer.
If data is comming faster that your programm retreive the packets, then the
LAN card buffer (and the OS buffer) will be full and packet will be dropped.
So you don't see all packets.

This doesn't happend with TCP since TCP is a "windowed protocol". Each
packet has to be acknoledged or will be retransmissted. To avoid slow down
because of those ack, the sender is allowed to send more packets while not
having received previous acknowledges but the number of packet sent without
ack is limited to a "windows size". Once that size is reached, the sender
stop sending. This will dramatically result the chances to lost packets
becaus ethey are sent too fast.

--
[EMAIL PROTECTED]
The author for the freeware multi-tier middleware MidWare
The author of the freeware Internet Component Suite (ICS)
http://www.overbyte.be


----- Original Message ----- 
From: "Udvari András László" <[EMAIL PROTECTED]>
To: "ICS support mailing" <twsocket@elists.org>
Sent: Wednesday, March 23, 2005 3:03 PM
Subject: RE: [twsocket] UDP datagram receive periodically freezes
forseconds... The saga continues


> Hi!
>
> I made some further investigation, did the following:
>
> I made the following setup: 1000 packets to be sent without any delay
between them, every packet is 1100 bytes long, and the following network
conditions:
> 1. Client-server is on the same computer (localhost)
> 2. Client-server on different computer, 100Mbit network intranet
connection
> 3. Client-server on different computer, GPRS (EDGE) intranet connection
>
> On the first case there was no problem, everything worked fine. On the 2nd
and 3rd case my program was unable to detect most of the packets (in case 2
about 200 of 1000 were detected on the client side, in the 3rd case less
than 100). The OnDataAvailable method of TWSocket I use for detecting the
datagrams:
>
>  procedure Tmainform.udplistenDataAvailable(Sender: TObject; Error: Word);
>  var Len    : Integer;
>      Src    : TSockAddrIn;
>      SrcLen : Integer;
>  begin
>   SrcLen := SizeOf(Src);
>   Len    := udplisten.ReceiveFrom(@incomingbuff, SizeOf(incomingbuff),
Src,SrcLen);
>   incomingsize:=len;
>   if Len >= 0 then
>      begin
>       if (FServerAddr.S_addr = INADDR_ANY)or(FServerAddr.S_addr
=Src.Sin_addr.S_addr) then
>          begin
>
workwithincomingdata(inet_ntoa(Src.sin_addr),ntohs(Src.sin_port),incomingbuf
f,len);
>          end;
>      end;
>  end;
>
> I used Ethereal for viewing the incoming data, and all (or at least most
of) the UDP packets was received according to Ethereal, but my program was
unable to capture them.
>
> What am I doing wrong? Or is it a normal behaviour?
>
> Thanks for your help:
> Andras
>
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Francois PIETTE
> Sent: Saturday, March 19, 2005 2:45 PM
> To: ICS support mailing
> Subject: Re: [twsocket] UDP datagramreceive periodically freezes for
seconds
>
> Use a sniffer to see if the datagrams are really sent by your program. If
> they are sent, it means you have a device that drop packets, maybe when
his
> buffer if full. You can use the free sniffer Ethereal (link on the links
> page at my website). If the datagrams are not sent, then there is
something
> wrong on your computer or program. Much more difficult to know what. You
> should first try the exe on another computer to see what happend.
>
> Remember UDP is by design a non reliable protocol.
>
> --
> [EMAIL PROTECTED]
> http://www.overbyte.be
>
>
> ----- Original Message ----- 
> From: "Udvari András László" <[EMAIL PROTECTED]>
> To: "ICS support mailing" <twsocket@elists.org>
> Sent: Saturday, March 19, 2005 1:52 PM
> Subject: FW: [twsocket] UDP datagramreceive periodically freezes for
seconds
>
>
> > Anybody has any other idea, in which direction should I look for the
> solution?
> >
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Udvari András László
> > Sent: Friday, March 18, 2005 8:26 AM
> > To: ICS support mailing
> > Subject: RE: [twsocket] UDP datagramreceive periodically freezes for
> seconds
> >
> > Sorry, it was my fault, the UDP datagrams are sent with a TWSocket, not
a
> TWSocketServer.
> >
> >
> > The listening TWSocket DataAvailable method is the following (partly
from
> the example project bound to ICS):
> >
> > procedure Tmainform.udplistenDataAvailable(Sender: TObject; Error:
Word);
> > var Len    : Integer;
> >     Src    : TSockAddrIn;
> >     SrcLen : Integer;
> > begin
> >  SrcLen := SizeOf(Src);
> >  Len    := udplisten.ReceiveFrom(@incomingbuff, SizeOf(incomingbuff),
Src,
> SrcLen);
> >  incomingsize:=len;
> >  if Len >= 0 then
> >     begin
> >      if (FServerAddr.S_addr = INADDR_ANY)or(FServerAddr.S_addr =
> Src.Sin_addr.S_addr) then
> >         begin
> >
>
workwithincomingdata(inet_ntoa(Src.sin_addr),ntohs(Src.sin_port),incomingbuf
> f,len);
> >         end;
> >     end;
> > end;
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On
> Behalf Of Wilfried Mestdagh
> > Sent: Thursday, March 17, 2005 9:12 PM
> > To: ICS support mailing
> > Subject: Re: [twsocket] UDP datagramreceive periodically freezes for
> seconds
> >
> > Hello Udvari,
> >
> > TWSocketServer does not handle UDP, only TCP.
> >
> > ---
> > Rgds, Wilfried
> > http://www.mestdagh.biz
> >
> > Thursday, March 17, 2005, 16:28, Udvari András László wrote:
> >
> > > Hi List,
> >
> > > I wrote a little client-server application, which measures UDP
> > > datagram transfer speed. The server is using TWSocketServer, and sends
> > > a 1500 byte length UDP datagram in every half seconds. The number of
> > > datagrams to be sent is a parameter, tipically some 100, below 1000.
> > > The client side receive these packets measures the speed
> > > (bytes/second) and the counts the missing or lost packets (every
> > > packet has an incremental unique id).
> >
> > > But on the client side there is a strange behaviour: in about every
> > > minute no datagram is coming for some seconds, and after that all of
> > > them coming in one bunch, like if emptying some kind of buffer. After
> > > that everything returns normal for about another 1 minute.
> >
> > > Is it a normal behaviour, or am I doing something wrong? On the
> > > server side everything seems to be OK, according to log file every
> > > packet is sent with correct timing.
> >
> > > Thanks for your help:
> > > Andras
> >
>
> -- 
> To unsubscribe or change your settings for TWSocket mailing list
> please goto http://www.elists.org/mailman/listinfo/twsocket
> Visit our website at http://www.overbyte.be
>


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to