This interaction is similar to the one in figure 2.27, in that it also uses a series of text boxes and arrows and is arranged in two side-by-side columns. In both columns, each text box has a black arrow pointing to the text box below it. Some boxes are also linked by blue arrows to the boxes in the column next to them. The column on the left is labeled "Server (Running in serverIP), and the column on the right is labeled "Client."
The first text box under Server reads:
Create socket, port=x,
for incoming request: (in black)
serverSocket =
socket () (in blue)
The next text box reads:
Wait for incoming
connection request: (in black)
connectionSocket = serverSocket.accept () (in blue)
The next text box reads:
Read request from (in black)
connectionSocket (in blue)
The next text box reads:
Write reply to (in black)
connectionSocket (in blue)
The last text box reads:
Close (in black)
connectionSocket (in blue)
A black arrow points from this text box back up to the space between the first text box ("Create socket") and the second text box ("Wait for incoming connection request") under Server.
In the right-hand column of information, the space immediately below the Client is empty, so that the first text box under Client aligns with the second text box under Server. This first text box under Client reads:
Create socket, connect
to serverIP, port=x: (in black)
clientSocket = socket () (in blue)
A dotted blue arrow points back and forth between this text box and the second text box under Server ("Wait for incoming connection request").
The next text box under Client reads:
Send request using (in black)
clientSocket (in blue)
A blue arrow points from this text box to the third text box below the Server ("Read request from connectionSocket").
The next text box under Client reads:
Read reply from (in black)
clientSocket (in blue)
A blue arrow points to this text box from the fourth text box under Server ("Write reply to connectionSocket").
The last text box below Client reads:
Close (in black)
clientSocket (in blue)