 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
csaaa Guest
|
Posted: Sat Sep 16, 2006 7:48 pm Post subject: TIdUDPServer questions |
|
|
I construct an UDP Server-side program with TIdUDPServer. I filled my code
of processing UDP datagrams in the OnUDPRead Event of TIdUDPServer. But I
found that the program processes UDP datagrams one by one. I want
multi-threads to process UDP datagrams simultaneously. Reading the Indy9
help document, I found TIdUDPListenerThread class. I can't find more
information about TIdUDPListenerThread class. I don't know whether
TIdUDPListenerThread class can help me construct multi-thread processing. I
was afflicted by the problem serval weeks. Who can show me a demo or give me
some hints. Any help will be appreciated.
csaaa |
|
| Back to top |
|
 |
Martin James Guest
|
Posted: Sun Sep 17, 2006 8:11 am Post subject: Re: TIdUDPServer questions |
|
|
csaaa wrote:
| Quote: | I construct an UDP Server-side program with TIdUDPServer. I filled my code
of processing UDP datagrams in the OnUDPRead Event of TIdUDPServer. But I
found that the program processes UDP datagrams one by one. I want
multi-threads to process UDP datagrams simultaneously. Reading the Indy9
help document, I found TIdUDPListenerThread class. I can't find more
information about TIdUDPListenerThread class. I don't know whether
TIdUDPListenerThread class can help me construct multi-thread processing. I
was afflicted by the problem serval weeks. Who can show me a demo or give me
some hints. Any help will be appreciated.
|
Well, would it not be easiest to take the datagram in the OnUDPRead
event and queue it off to a pool of lower-priority 'datagram-processing'
threads?
Looking briefly at the Indy 9 I have loaded at the moment, it appears
that the incoming datagrams are loaded into an internal, protected
TmemoryStream instance. To queue off the datagrams using TIdUDPServer
'as-is' would seem to imply copying the data, (again), into some
intermediate 'Tdatagram' object. I'm guessing, (though Remy is the real
expert here), that a descendant of TIdUDPServer could add a
'createNewDatagramStream' method that would create a new instance of the
TmemoryStream for the next datagram and so allow the 'AData' stream
instance received in 'OnUDPRead' to be detached from the TIdUDPServer
and so be queued off without copying.
Indy could have made this easier by passing the AData as a var parameter
so that an OnUDPRead handler could easily signal that it wanted to
'keep' the stream by setting the parameter to nil after queueing it off,
so prompting the OnUDPRead caller to create a new stream without any
extra 'use a new stream for the next datagram' methods.
Rgds,
Martin |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Sep 18, 2006 9:32 pm Post subject: Re: TIdUDPServer questions |
|
|
"csaaa" <csaaa (AT) 21cn (DOT) com> wrote in message
news:450c0f49 (AT) newsgroups (DOT) borland.com...
| Quote: | I construct an UDP Server-side program with TIdUDPServer. I filled
my code of processing UDP datagrams in the OnUDPRead Event of
TIdUDPServer. But I found that the program processes UDP
datagrams one by one.
|
Why is that a problem? You can't process multiple datagrams at a time on a
given IP/Port to begin with. What exactly are you trying to accomplish that
you are unable to?
| Quote: | I want multi-threads to process UDP datagrams simultaneously.
|
In what way exactly? Please be more specific.
| Quote: | Reading the Indy9 help document, I found TIdUDPListenerThread class.
I can't find more information about TIdUDPListenerThread class.
|
That is because there is no information for it. It is a private class for
Indy's internal use.
| Quote: | I don't know whether TIdUDPListenerThread class can help me construct
multi-thread processing. |
You cannot use TIdUDPListenerThread in your own code.
| Quote: | I was afflicted by the problem serval weeks.
|
What is the actual problem?
Gambit |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|