Professional Documents
Culture Documents
M. L. Liu
Client host
...
service request
a client process
server host a server process
Server host a service
Client host
...
...
The Client-Server Paradigm, conceptual
start service
accept a client's
request for a session
conduct a session
with the client
response 1
request2
response 2
requestn
response n
response 1
request2
response 2
requestn
response n
client-side software
server-side software
presentation logic
application logic
application logic
service logic
service logic
Service logic
The MyClientDatagram.java (Figure 6c) class provides
the details of the IPC service, in this case using the
datagram socket API.
Distributed Computing, Liu 19
Advantages of separating the layers of logic
It allows each module to be developed by people with special
skills to focus on a module for which they have expertise.
Software engineers who are skilled in user interface may
concentrate on developing the modules for the presentation
logic, while those specializing in application logic and the
service logic may focus on developing the other modules.
server
client
sequence diagram
m1
m2
sequence diagram
public int getPort( ) Return the port number on the remote host from a socket
of which the datagram was received.
presentation + application
logic
Daytime Se rve r1
se ndMe ssage ( )
re ce ive Me ssage ( )
re ce ive Me ssage And
Se nde r( )
service logic
Distributed Computing, Liu 26
UML Diagram for the Datagram
Daytime Client
presentation logic
DatagramPace t
DaytimeClientHelper1
MyC lie ntDatagram
Socke t DatagramSocke t
se ndMe ssage ( )
re ce ive Me ssage ( )
application logic
Distributed Computing, Liu 27
Daytime Protocol Implementation
Connection-oriented Daytime Server Client:
Sample 2 using connection-oriented
sockets:
DaytimeServer2.java
DaytimeClient2.java
DaytimeClientHelper2.java
MyStreamSocket.java
Se rve rSocke t
Daytime Se rve r2
MyStre amSocke t
Socke t
se ndMe ssage ( )
re ce ive Me ssage ( )
re ce ive Me ssage And
Se nde r( )
se ndMe ssage ( )
re ce ive Me ssage ( )
application logic
service logic