In the Creating an echo server recipe of this chapter, we created an echo server using Apple's CFNetwork API. This server accepted incoming text and echoed it back to the client. That recipe demonstrated how to send and receive text through a socket connection.
This following recipe will demonstrate how to send and receive datafiles such as images through a socket connection. Sending and receiving data over a socket connection with CFNetworking is not that different from sending and receiving text. You basically go through all the same steps to set up the socket, but you finally receive
CFData rather than a character array.
We will be updating the
CFSocketServer class from the Creating an echo server recipe of this ...