Apple Developer Connection
Advanced Search
Member Login Log In | Not a Member? Contact ADC

Getting Started with Networking

Mac OS X offers a rich set of networking APIs that provides advanced features while maintaining compatibility with open standards. It supports the dominant media types, protocols, and services in the industry as well as new and innovative services from Apple. You can use Apple's networking APIs to develop software that accomplishes a wide range of networking tasks, from providing access to web services within your application to writing a device driver for a network hardware device.

Start Here

Before you begin to write any code, it’s a good idea to become familiar with the technologies underlying the networking features of Mac OS X. If you haven’t already done so, read:

Choose a Learning Path

If you're developing software that communicates over a network, such as a client application connecting to a server application, you want to be familiar with the different APIs that Mac OS X offers so you can take advantage of network protocols and services. If you're developing applications that will interact with web applications, you need to know how to use Apple's web-based APIs. If you're writing network software for the kernel, you need to understand the Mac OS X software layers. Even though these paths may seem orthogonal, they are not necessarily mutually exclusive.

Developing Client/Server Network Applications

To write an application for Mac OS X that communicates over the network requires the use of protocols and services.

  • If you have existing code based on BSD sockets, you don't need to make any adjustments to your code. Mac OS X has full industry standard support for BSD sockets.

  • If you want to send data to servers over a network with a C API, you need to learn about network protocols such HTTP, HTTPS and FTP. To develop applications that take advantage of these protocols, read CFNetwork Programming Guide.

  • If you want to use sockets in a run-loop based environment, such as a graphical user interface, you need to learn about Core Foundation's socket API. Read CFNetwork Programming Guide for more information.

  • If you want a simple way to access URLs in an Objective-C application, you need to learn about the Foundation URL Loading System. Read URL Loading System for more information.

  • If you want your application to find other network services with no user configuration, you should become familiar with Bonjour by reading Bonjour Overview. To develop Bonjour-enabled software on Mac OS X in C or Objective-C for a graphical user interface or run loop based application, read NSNetServices and CFNetServices Programming Guide. To develop Bonjour-enabled software on Linux, on Windows, using Java, or at the socket level on Mac OS X, read DNS Service Discovery Programming Guide.

  • If you want to determine or configure network preferences, you need to understand the architecture of the System Configuration services. To learn how to use System Configuration services in your application, read System Configuration Programming Guidelines.

  • If you want to interact with another thread or task in Cocoa, consider using Distributed Objects. Distributed Objects is a Cocoa technology for remote procedure calls. To learn how to use Distributed Objects, read Distributed Objects Programming Topics.

  • If you want your application to take advantage of server based technologies, consider Mac OS X Server, with its extensive suite of services such as file, Open Directory, and QuickTime streaming.

Developing Web-based Applications

For developing applications either to view web content or to develop a web service application, there are a variety of Mac OS X APIs.

  • If your Cocoa application needs to display or edit HTML content, the Web Kit is ideally suited to assist you. To learn how to use the Web Kit in your application, read Web Kit Objective-C Programming Guide.

  • If you need an interface for accessing web services (such as Amazon.com) in your Cocoa application, you want to use WSDL web services. To learn how to do this, read Web Services Core Programming Guide.

  • If you are looking for more information about creating web content or developing web server applications, read Getting Started with Internet and Web.

Developing In-Kernel Networking Software

To write software in the physical layer to the transport layer of the OSI communications model, you need to interact with the kernel.

  • If you are developing a networking device driver, you need to use the I/O Kit. To learn how to use the I/O Kit for network drivers, read Network Device Driver Programming Guide.

  • If you need to extend or modify the Mac OS X networking infrastructure, use network kernel extensions. To learn, for example, how to implement a custom firewall, read Network Kernel Extensions Programming Guide.

  • If you need to do socket-level network communications from your kernel code, use the Kernel Programming Interface Sockets API. Read kpi_socket.h in the KPI Reference for more information about using sockets in the kernel space.

Next Steps

The Networking Reference Library includes the following high-level resource pages, which you can bookmark for easy access:

  • Guides

    Conceptual and how-to information for networking.

  • Reference

    Focused, detailed descriptions in reference format for networking.

  • Sample Code

    Samples demonstrating how to use APIs and tools.

  • Technical Notes

    Supplemental documents on various networking issues.

  • Release Notes

    Late-breaking news and highlights of new or changed features in the latest release.

  • Technical Q&As

    Design information and FAQs by Apple’s support engineers.

  • Mailing Lists

    The Macintosh Network Programming mailing list (macnetworkprog) is an excellent place to begin discussing Macintosh network programming. The Mac OS X list (macos-x-server) is for discussing issues relevant to the installation and administration of Mac OS X Server and related technologies. The bonjour-dev mailing list is for discussing Bonjour programming.



Last updated: 2006-05-23




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.