Prev | Current Page 789 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The first is called synchronous
communication because the flow of the messages is always alternating between a request and its answer.
The second is defined asynchronous communication because a system does not have to wait for an
answer before making a new request. When multiple requests are made, the sequence and timing of the
responses cannot be predicted.
The biggest advantage of a synchronous connection is simplicity: The request method returns directly
the response provided by the server. The biggest drawback is that the client code freezes until a response
is received; this can be a negligible effect if the communication is local, but can be more an issue if the
communication involves an HTTP connection. If an error occurs in the communication process, a
standard exception is raised by the request method.
The asynchronous connection is a little more complex to set up because the request method must be
invoked with an extra argument, a function that handles the response. The process does not lock
the client at any step.


Pages:
777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801