View Full Version : Can anyone suggest a book for learning about Networking?
Jul 15, 2010, 02:21 PM
I'm trying to find a good way to learn about Bonjour/Zeroconf networking on the iPhone (with an eventual view to linking with a Mac client) however I have little experience with network programming so I'm looking for something that really works from the ground up. I've tried several online tutorials and the like but have yet to find one that a) works, and b) starts from a low enough level.
Anyone got any ideas?
EDIT: Needn't be a full book on Networking, just one with a good example or two perhaps?
Jul 15, 2010, 02:36 PM
Post the tutorials that didn't work, so we know what you need a lower level than.
Also, do you need to understand the APIs, or do you need to understand how the actual network protocols work "on the wire"? For the latter, you can read the RFCs, which cover details very precisely, in as low a level as you care to go.
Jul 15, 2010, 02:43 PM
Essentially what I need is to be able to setup a simple program that sends a message from iPhone to Mac i.e.
iPhone sends message "A" and Mac responds with method 'A'
From a reading point of view I'd like something that allows me to work on a basic level, but also allows me to learn more if I want to...if that makes sense. It's kind of lost me to some extent, I get the general ideas I just don't seem to be able to make it work yet.
The tutorial I followed is here:
Now it all runs and the like, discovers services on the Network however as soon as either button is pressed, it crashes - I've attached my working as a file just to show what I've done - perhaps someone can see my errors?
Any help is very much appreciated, Networking seems something that isn't particularly well catered for with tutorials.
Jul 15, 2010, 05:02 PM
Honestly, it is doubtful anyone is going to debug your code for you. Run it in debug mode and also consider learning how to use Instruments. Also try 'Build and Analyze".
I haven't found one good source of information on how to do network programming on OS X or iOS. Here are a couple of links that may be helpful.
Troubleshooting Bonjour Networking for the iPhone (http://excitabyte.wordpress.com/2010/01/17/troubleshooting-bonjour-networking-for-the-iphone/)
cocoaasyncsocket (http://code.google.com/p/cocoaasyncsocket/): Wrapper for CFSocket and CFStream that may make life easier.
Bonjour Browser (http://www.tildesoft.com/): Allows you to see what is advertising as Bonjour services.
The Apress book, "iPhone Games Projects" has a chapter titled "Networked Games: Choosing the Right Option" which isn't bad.
Although you might get something out of the "iPhone Cool Projects" networking chapter, it uses UDP which is a protocol not guaranteed to deliver it's content.
There are 2 or three WWDC 2010 videos that discuss networking.
Expect to spend a lot time on your networking code. It is difficult stuff. I used many NSLogs and went so far as doing MD5 checksums on the data I was passing and confirming it on the receiver. You also may have concerns regarding endianness (http://en.wikipedia.org/wiki/Endianness).
Jul 15, 2010, 05:30 PM
[QUOTE=xStep;10549124]Honestly, it is doubtful anyone is going to debug your code for you. Run it in debug mode and also consider learning how to use Instruments. Also try 'Build and Analyze".
This is fair comment and not my intention at all, just threw it up for reference purposes really in case anyone wanted to see it.
Will certainly look at the other information in the morning when I'm more awake but thanks in advance :-)