Java Reference
In-Depth Information
MyServiceInterf
MyServer
doMyService()
startMyService()
DSocketListener
DActivity
MyService
DParser
step()
run()
doMyService()
decode()
encode()
getActivity()
DObserver
MyParser
DSocketActivity
update()
Client
step()
quit()
update()
decode()
encode()
getActivity()
Figure 19.8 The framework components needed to access remote services through Sockets
concrete implementation of class DParser (e.g. MyParser ) to translate incom-
ing socket messages into service method invocations and to serialize service
events. Simple clients like applets running inside a browser can thus access
remote services using Sockets.
Figure 19.9 shows the interaction diagram that illustrates three phases of
the socket-based communication between a control module and its remote
clients.
Phase 1: Client sends a request for socket connection to DSocketListener ,
which creates a DSocketActivity instance that will manage the socket-based
DSocket
Listener
DSocket
Activity
MyParser
MyService
MyServer
Client
connect()
new
new
getActivity()
new
return myService
startActivity
(myService)
write
(message)
decode
(message)
doMy
Service()
update
(event)
write
(message)
encode(event)
return message
Figure 19.9 The interaction diagram that illustrates the socket-based communication
Search WWH ::




Custom Search