Re: 1000's UDP packets arrive same time problem
- From: "news.sbcglobal.net" <myreceiver@xxxxxxxxxxx>
- Date: Mon, 16 May 2005 01:45:06 GMT
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 <=-
.
- References:
- 1000's UDP packets arrive same time problem
- From: ramta jatt via . NET 247
- Re: 1000's UDP packets arrive same time problem
- From: Helge Jensen
- 1000's UDP packets arrive same time problem
- Prev by Date: Re: NTLM failure
- Next by Date: Image acquitision using WIA 2.0
- Previous by thread: Re: 1000's UDP packets arrive same time problem
- Next by thread: Problem in Automaion Addin using c#
- Index(es):
Relevant Pages
|