Raphael Collet wrote:
>
> If you want the variable Out to behave like an acknowledgement, it should be
> bound on the server side.  Here is how you can redefine Post:
>
> local MAs in
>    P={NewPort MAs}
>    Ms = thread {Map MAs fun {$ M#Ack} Ack=unit M end} end
>    proc {Post post(M Ack)} {Send M#Ack} end
> end
>
> You can also use Port.sendRecv to send a pair message-response.  Its
> implementation is optimized in Mozart 1.4.0.
>
> I don't know whether you can work around the bug with that trick, but you
> can give it a try...
>
>   

so i did.  here is a new version of the server and the client.

%server
functor ...
define
   Requests
   RequestPort = {NewPort Requests}
   proc {Handler request(Message Response)}
      {System.show Message}
      Response = response end
   fun {Post Message}
      {Send RequestPort request(Message $)} end
   {Pickle.save {Connection.offerUnlimited Post} ...}
   {ForAll Requests Handle}
end

%client
functor ...
define
   Post = {Connection.take {Pickle.load ...}}
   Response = {Post hello}
   {Wait Response}
   {System.show Response}
   {Application.exit 0}
end


when i compile and run them, the following happens, as expected:
- the server displays 'hello' (it must have received the message)
- the client displays 'response' (it must have received the response)
- the client terminates

and then the server starts spinning, and starting the client again makes
it block.

if there is a bug in the system, it makes the system pretty much
unusable.  i still hope this is somehow my fault.

vQ

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to