Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 17. Network Access > Connecting to Servers

Connecting to Servers

From: nsstream.m

 6 NSInputStream *in;
 7 NSOutputStream *out;
 8 NSHost *host = [NSHost hostWithName:
 9   @"example.com"];
10 [NSStream getStreamsToHost: host
11                       port: 80
12                inputStream: &in
13               outputStream: &out];
14 [in open];

Objective-C provides a set of Java-like stream classes for network communication, as well as the low-level UNIX interfaces. Unfortunately, the stream versions are not particularly useful. They don’t provide a clean way of adding filters like compression or of negotiating encryption in the middle of a connection, which a lot of modern protocols require.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint