Re: 1000's UDP packets arrive same time problem

Tech-Archive recommends: Fix windows errors by optimizing your registry



How about a conceptual design like ...

1. main program start the following threads
a. UDP receive thread
b. queue processing thread
storage:
i. collection : queue (sync'd)
ii. data object : stores received UDP packet
2. UDP receive thread
when receive UDP packet : instantiate new data object; enqueue data
object
3. queue processing thread
if not empty queue, dequeue and process data object.

Should be able to handle very high I/O rate, choice of language, VB or C# is
irrelevent.

Regarding packet loss, you may monitor your system's network interface for
UDP drops just to get some sense of the situation. If the loss is somewhere
along the network path between the srv and the dest., there is not much you
can do unless you implement some kind of reliable delivery check. But then,
you could have used TCP.


"Helge Jensen" <helge.jensen@xxxxxxx> wrote in message
news:O7r9DXVWFHA.3320@xxxxxxxxxxxxxxxxxxxxxxx
> ramta jatt via .NET 247 wrote:
>
>> I have problem of packet drop out.
>
> UDP transfers are unreliable, packets can be dropped at any time. Probably
> your network is congested or you cannot handle the amount of input fast
> enough.
>
>> How much is the buffer size for UDP packets? Can I chnage it? My app can
>> not allow droping of packets.
>
> You should really make a protocol on top of UDP to ensure against packet
> loss.
>
> With the amounts of data that you seem to be sending are you sure you
> don't just want to be able to detect that packages have been lost?
>
> Exactly what can you do if a package is lost?
>
>> Second problem is, the packets contain different type of information and
>> will be processed by different Threads. I f I use a queue, I will be
>> having a thread-safe problem.
>
> Make yourself a thread-safe Producer/Consumer queue. You can use a Mutex
> (for example) to block readers untill data is available.
>
>> Please suggest me some design that will help me to solve above problems.
>> I am using vb.net
>
> It sounds like you need to be able to offload packages from the OS as fast
> as possible. Make the routine that receives packages queue the raw package
> so it does as little work as possible. Have some lower priority threads
> for processing the genberated queue. Not that this might cause the queue
> to grow indefinatly, with disasterous results, if you dont have enough
> processing power to process it.
>
> You can also have a look at asynchroneous IO, but that's going to generate
> a radically different way of coding your IO, and it's easy to get wrong.
> It's not too bad if you just queue the incoming packages, but still...
>
> Possibly you could think about coding the performance-bound IO in C# to
> skip the VB interpretation? (I know close to nothing of VB, and you should
> check that you actually gain anything by changing this part to C#/...
> yourself).
>
> --
> Helge Jensen
> mailto:helge.jensen@xxxxxxx
> sip:helge.jensen@xxxxxxx
> -=> Sebastian cover-music: http://ungdomshus.nu <=-


.



Relevant Pages

  • Re: Architecture advise wanted.
    ... > queue has an object and then go. ... (accepting UDP connections from UDP clients, ... following code listening for UDP. ... Consumer class would have to be polling it constantly. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UDP server socket
    ... > is that a system dependent feature or can i change that (i didn't see ... I don't believe (though I'm not an expert in UDP) that you can ... "queue up" UDP packets at all. ... guarantees as to how many UDP packets can be handled if there ...
    (comp.lang.python)
  • Re: Architecture advise wanted.
    ... Create a listener thread that listens for udp on port n. ... packets and verifies them, etc and puts them into a queue (blocking queue, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Changes in the network interface queueing handoff model
    ... bouncing around for some time is a restructuring of the network interface packet transmission API to reduce the number of locking operations and allow network device drivers increased control of the queueing behavior. ... to "start" output by the driver. ... encapsulation and wrapping, and notifies the hardware. ... The ifnet layer send queue is becoming decreasingly useful over time. ...
    (freebsd-arch)
  • Re: Changes in the network interface queueing handoff model
    ... bouncing around for some time is a restructuring of the network interface packet transmission API to reduce the number of locking operations and allow network device drivers increased control of the queueing behavior. ... to "start" output by the driver. ... encapsulation and wrapping, and notifies the hardware. ... The ifnet layer send queue is becoming decreasingly useful over time. ...
    (freebsd-net)