Creating an echo client

In the Creating an echo server recipe of this chapter, we created an echo server and then tested it using telnet. Creating the server was pretty fun, but testing with telnet was a kind of anti-climax; so in this recipe, we will be creating a client that we can use to connect to our echo server.

When we created the echo server, we created a BSDSocketServer class to help with the creation of our server applications. In this recipe, we will be creating a BSDSocketClient class to help with the creation of our client applications.

Getting ready

This recipe is compatible with both iOS and OS X. No extra frameworks or libraries are required.

How to do it…

Now let's create an echo client that will communicate with our echo server:

Get iOS and OS X Network Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.