Game Development Reference
In-Depth Information
3
Networking
In this chapter, we will cover:
F Fetching list of photos from Flickr and Picasa
F Downloading images from Flickr and Picasa
F Performing cross-platform multithreading
F Synchronizing native cross-platform threads
F Managing memory using reference counting
F Implementing asynchronous task queues
F Handling asynchronous callbacks invocation
F Working with the network asynchronously
F Detecting a network address
F Writing the HTTP server
Introduction
Networking is an inherently asynchronous and unpredictable area in terms of timing. One may
not be sure about the reliability of the connection. Even when we use the TCP protocol,
there is no guarantee on the delivery time, and nothing prevents the applications from
freezing while waiting for the data in the socket. To develop a responsive and safe application,
a number of problems must be solved: we need to be in full control of the download process,
we have to limit the downloaded data size, and gracefully handle the errors that occur.
Without delving into the details of the HTTP protocol implementation, we use the libcurl library
and concentrate on higher-level tasks related to game development.
Search WWH ::




Custom Search