Royi Namir
Royi Namir

Reputation: 148524

How the wcf blocks the client when IsOneWay=false?

Host : has a function which is : IsOneWay=False

this function when called - pops a MessageBox in the HOST.

Client : has a winform that has only button that calls the Host's func.

if the function in the host IsOneWay=true - i can multi press the client button ( he doesnt care if i released the messagebox on the Host or not).

but if the IsOneWay=False - then he let me press just once ( until i release the MesageBox on the Host)..

host does he do that ?

How the Client knows that he should be blocked until the user releases the MessageBox on the Host side ?

Upvotes: 1

Views: 812

Answers (1)

Joshua
Joshua

Reputation: 8212

The WCF host isn't responding to the client until the message box is dismissed.

If you were to break into the debugger on the client side you should see that your code is still within the WCF call to the host. If you waited long enough it would eventually time out. WCF can do this because IsOneWay=false requires the server to return before the client can continue executing. When IsOneWay=true the client sends the request and the server responds right away with success allowing the client to continue (before any server code is executed).

IsOneWay=false
   Client       Server
   ------    |  ------
1. click    --> method --> messagebox waits for OK
(client can't continue until server returns)
2. continue <-- method <-- user dismisses messagebox

IsOneWay=true
   Client     Server
   ------  |  ------
1. click  -->  method --> messagebox waits for OK
(client continues regardless of server state)
2. click  -->  method --> 2nd messagebox waits for OK
                          user dismisses messageboxes
etc...

Upvotes: 3

Related Questions