Running the Multi-Connection Client and Server
00:00 In this lesson, you’ll see the multiconnection echo server and client working. Now that you’ve seen the code for the new echo client and server, you’re going to see them executing. You’ll need two separate terminal windows, one for the server and one for the client.
00:26 If they’re not provided, the program displays a short message on the proper way to start the program, and then exits. In addition to the host and port, the client wants to know how many connections you want to create. Let’s do this.
01:25 Notice first, the client connects to the server three times, sends each pair of messages on each, and then prints them when echoed back. Because the selector is dealing with concurrent activities, it’s not guaranteed that these things will happen in the order you expected.
01:59 Looking back at the server, you can see it received three connections, echoed back three pairs of messages, and then closed three connections. And again, because we’re dealing with concurrent events, there’s no guarantee the exact order that those events might happen.
Become a Member to join the conversation.