Re: Winsock & IO Completion problem
- From: "Arkady Frenkel" <arkadyf@xxxxxxxxxxxxxxxx>
- Date: Tue, 7 Mar 2006 16:38:15 +0200
Communications are always ( almost ) bidirectional, but each channel have
server and client. And it's not a problem to have server and client on both
sides but only server usually have to have IOCP associated for scalability
reasons ( not your case as I see it you have P2P ( server /client pair for
each peer ) )
Arkady
"Nadav" <Nadav@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:3B846F73-AF03-4D88-AB03-FBF64BA4D40C@xxxxxxxxxxxxxxxx
Well, communication is bidirectional, hence, there is no client or server,
the two are servers communicating with each other, taking that in mind,
when
one of the servers issues a WriteFile request two identical IO Completion
notifications are sent ( GetQueuedCompletionStatus returns twice for the
same
IO ), similar phenomenon happen when executing the following flow:
A = CreateFile
B = DuplicateHandle ( A )
Associate( A )
Associate( B )
Calling Write( A ) will trigger two completion notification and not one.
I suspect that when the two server modules/objects share the same process
similar thing happen, the only thing I am trying to figure out is how to
prevent this behavior, If I could query the completion port regarding it's
associated handles I could prevent this redundant association.
--
Nadav
http://www.sophin.com
"Arkady Frenkel" wrote:
When you send 2 notifications receive one that data sent ( from C or
v.v. )
and another that those data received ( on B or v.v. ) .
and that OK if you use IOCP. But why you use IOCP on the client too ,
that
have to be on server side only
Arkady
"Nadav" <Nadav@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:110496ED-EB81-44FB-AD84-906ADB9E6F90@xxxxxxxxxxxxxxxx
Hi,
[*] I am implementing a communication framework, this framework use
winsock
for TCP Message oriented bidirectional communication, the framework use
a
thread pool and IO Completion port for asynchronous communication.
[*] Thread pool socket association process:
Listener:
1.Create overlapped socket A
2.bind ( A )
3.listen( A )
4.B = accept( A )
5.Associate the socket B with the thread pool.
?Client?:
1.Create overlapped socket C
2.connect ( C )
3.Associate the socket C with the thread pool.
[*] For flexibility reasons, it should be transparent whether two
modules
communicate over network boundary, process boundary or module boundary
(
when
two modules that share the same process communicate ), communicating
over
network and process works fine, however when dealing with inproc
communication ( two modules that reside in the same process
communicating
using TCP ) things are messing up, I get two completion indications for
each
IO operation on sockets, e.g. Calling ReadFile( B ), results ( when a
message
is received ) two identical completion requests, it seems as if sockets
B
and
C ( that share the same process ) refer to the same kernel object, as
each
is
being associated with the same completion pool separately a completion
notification is received for each different association ( there are two
associations one for B and the other is for C ) and two completion
notifications are being received although a single IO was performed.
What may cause this problem? How can I know whether a certain handle is
already associated with a specific thread pool? What can I do to
resolve
this
problem?
P.S.
Yess, I need the two modules to communicate with each other using TCP
although they share the same process.
Any help, comment or remark would be appreciated.
--
Nadav
http://www.sophin.com
.
- References:
- Re: Winsock & IO Completion problem
- From: Arkady Frenkel
- Re: Winsock & IO Completion problem
- From: Nadav
- Re: Winsock & IO Completion problem
- Prev by Date: Re: Winsock & IO Completion problem
- Next by Date: Re: Layered Service Provider incompatibilities
- Previous by thread: Re: Winsock & IO Completion problem
- Next by thread: Re: Winsock & IO Completion problem
- Index(es):
Relevant Pages
|
Loading