3. Comparison of Client/Server Model Implementation
3.2 Discussion of Mechanisms Used in Comparison
Models
For comparative purposes I have chosen to use a
traditional mechanism, Sockets. The sockets mechanism is more
primitive in its application than RMI and it is this quality that
makes it an ideal comparison model. The limited complexity of
the Socket mechanisms emphasis's the greater functionality of
RMI and significantly highlights the potential problems presented
by the increased complexity of the RMI mechanism.
3.2.1 Sockets
As with RMI, sockets are used to create a communication
channel between two processes. Sockets establish a communication
channel between server and client as follows. The server listens
on a certain port to see if any processes are interested in communicating
with it. When another process, the client, wishes to communicate,
it first notifies its OS. The OS assigns the client an unused
port to use. The client then contacts the server, using the servers
IP address and port number, to notify the server process of its
wish to communicate, at the same time identifying itself and its
port number [3]. This is illustrated in Figure 7.

Figure 7. Client requesting connection
on server port [4]
If all goes well the server will accept
the connection. As the original port the server was listening
on is now used for the connection to the client a new port is
assigned to the server for the purpose of listening for connection
requests. This is illustrated in Figure 8.

Figure 8. Server establishing connection
[4]
The client and server can now communicate
by reading from or writing to their sockets [4].
Communication between client and server is done through the sending
of packets of data. Sockets present data packets as a stream of
bytes.
Next Page