Re: Winsock & IO Completion problem



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





.



Relevant Pages

  • Another question about OpenOffice (and component based programming in general)
    ... if my program is going to connect the OO server via socket 8100 ... there is some sort of communication going on. ... If pipe: what is the name of the pipe? ...
    (comp.lang.java.programmer)
  • Re: stop Socket.BeginReceive before comlpete
    ... Peer-to-Peer Communication Across Network Address Translators ... you will also need the socket to listen to the ... coordinate the two clients). ... Can you enlaborator how did you listen to the Server? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: creating server socket program to handle multiple client at same time
    ... > if no then select is only thing to have server socket program on one ... > pc and other clients on many pcs to have communication with server? ... accept returns a socket file descriptor ... forking a child you can have a select call and pass this descriptor to ...
    (comp.unix.programmer)
  • RE: Build Solution from network share in VS2005 wont work - please he
    ... So the problem seems due to the file share communication between your WIN ... 2003 server and WIN XP work station (dev box). ... Build Solution from network share in VS2005 won't work - please ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Re: Event IDs 1030 & 1058 (again)
    ... > Windows Platform Support Team ... That both DC's point to the same server as the preferred DNS server. ... >> "Digitally sign server communication " match on all DC's ... >> Microsoft Network Client: ...
    (microsoft.public.windows.group_policy)

Loading