WCF and duplex service contracts

K

klem s

Yesterday I’ve started learning WCF and while I thought it would take
at least a week before I get utterly confused, it actually took only
two days … yay :D


1) WCF enables bidirectional communication through duplex service
contracts. Thus
with duplex operations client too must create an endpoint, so that
service is able to send messages back to the client

a) How then is with request-response operations service’s endpoint
able to send the result ( aka message ) of an operation back to the
client, without a client having to create an endpoint? Thus, how does
a service know where to send a reply?

b) thus don’t request-response operations also use bidirectional
communication?

c) anyways, why can’t with duplex operations service’s endpoint figure
out where to send reply the same way as with request-response
operations, thus without the client having to create an endpoint?

2) Depending on the binding used, WCF will create one or two channels
to implement duplex operations. Thus, protocols that support
bidirectional communication ( TCP ) will use only one channel, while
WCF will create an additional channel for protocols that don’t support
bidirectional communication ( HTTP )

a) Doesn’t HTTP usually run on top of TCP? If so, then why can’t it
support bidirectional communication?

b) I’ve also read that if WCF creates a second channel ( to implement
duplex operations ), then both protocols are symmetrical

Symmetrical how?



c) “With duplex operations unsolicited messages can be sent in either
direction”

I assume by “unsolicited messages” it is meant that receiver gets a
message which it didn’t explicitly requested? But:

* if client initiates a duplex operation, then in some way it has
requested a message, even though it doesn’t know when the message will
arrive or even how many messages will arrive!

* since communication is always initiated by the client, doesn’t that
mean that all messages received by the service are unsolicited?


3) Not sure how to ask this - I assume if instead of using duplex
contract we solve the problem of two way messaging by using a pair of
one-way contracts, then WCF isn’t really “aware” there is actually two
way messaging going on?

thank you
 
K

klem s

So bidirectional communication represents the ability of protocol and
cable to send messages in both directions ( regardless if both ends
can send packets at the same time or just one end at the time)? And
unidirectional is where during the lifetime of connection traffic can
only travel from, say, machine1 to machine2, but never vice versa?!

While full duplex and half duplex are both bidirectional, but with
full duplex traffic can go in both directions at the same time?


"Both"?  Which "both"?

Ok, here is the whole text:

“ To facilitate messages flowing back from the service to the client,
WCF may create an additional channel. If the initial channel cannot
support bidirectional communication, the WCF creates a second channel,
using the same protocol as was specified by the service’s endpoint,
making the protocols symmetrical in both directions.”
Which "duplex"?  Half or full?  Surely that quote refers to full-duplex.
  Or does WCF define "duplex" in some way different than the usual usage?
The whole text:

“A duplex service contract implements duplex message pattern, in which
unsolicited messages can be sent in either direction after the
communication channel is established. Operations over duplex channel
can be request-reply or one-way.”

On the contrary, I'd say that by definition, a full-duplex configuration
precludes the assumption that "communication is always initiated by the
client".  You don't need generally need full-duplex unless either end is
able to initiated communication (ignoring for a moment lower level
usages, such as streaming data with running acknowledgements).
So particular service operation could in fact initiate the
conversation ( can’t imagine how that would be done though, since
client side endpoint is created dynamically by WCF only ( I think )
when client calls service’s endpoint )?!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top