* Added a timeout property to TCPConnection. Set it before calling -open, if you want a shorter timeout than the default.
* Made the utility function BLIPMakeError public.
5 // Created by Jens Alfke on 5/24/08.
6 // Copyright 2008 Jens Alfke. All rights reserved.
8 // This file just contains the Doxygen comments that generate the main (index.html) page content.
11 /*! \mainpage MYNetwork: Mooseyard Networking Library, With BLIP Protocol Implementation
13 <center><b>By <a href="/Jens/">Jens Alfke</a></b></center>
17 \section intro_sec Introduction
19 MYNetwork is a set of Objective-C networking classes for Cocoa applications on Mac OS X.
22 <li>Networking utility classes (presently only IPAddress);
23 <li>A generic TCP client/server implementation,
24 useful for implementing your own network protocols; (see TCPListener and TCPConnection)
25 <li>An implementation of <a href="#blipdesc">BLIP</a>, a lightweight network protocol I've invented as an easy way
26 to send request and response messages between peers. (see BLIPListener, BLIPConnection, BLIPRequest, etc.)
29 \section license License and Disclaimer
31 MYNetwork is released under a BSD license, which means you can freely use it in open-source
32 or commercial projects, provided you give credit in your documentation or About box.
34 As I write this (May 2008), MYNetwork is still very much under development. I am using it as the foundation of my own commercial products, at least one of which is currently at about the alpha stage. I'm making changes to this code as I see fit, fairly often.
36 That's good, in that the code is getting real-world use. But it also means that APIs and functionality are subject to change. (Of course, the entire revision tree is always available, so you're free to stick with any revision you like, and even "cherry-pick" desired changes from future ones.)
38 Not all of this code gets thoroughly exercised by my test cases or my applications, so some things may not work. Obviously, this code comes with no warranty nor any guarantee of tech support, though I will try to do my best to help out. Hopefully the source code is clear enough to let you figure out what's going on.
40 If you come across bugs, please tell me about them. If you fix them, I would love to get your fixes and incorporate them. If you add features I would love to know about them, and I will incorporate them if I think they make sense for the project. Thanks!
42 \section blipdesc What's BLIP?
44 <table style="background-color: #fff; padding: 5px; float: right" cellspacing=0>
46 <img src="http://groups.google.com/groups/img/3nb/groups_bar.gif"
47 height=26 width=132 alt="Google Groups">
49 <tr><td style="padding-left: 5px;font-size: 125%">
52 <tr><td style="padding-left: 5px">
53 <a href="http://groups.google.com/group/blip-protocol">Visit this group</a>
57 BLIP is a message-oriented network protocol that lets the two peers on either end of a TCP socket send request and response messages to each other. It's a generic protocol, in that the requests and responses can contain any kind of data you like.
59 BLIP was inspired by <a
60 href="http://beepcore.org">BEEP</a> (in fact BLIP stands for "BEEP-LIke Protocol") but is
61 deliberately simpler and somewhat more limited. That results in a smaller and cleaner implementation, especially since it takes advantage of Cocoa's and CFNetwork's existing support for network streams, SSL and Bonjour. (BLIP is currently a bit under 2,000 lines of code, and the rest of the MYNetwork classes it builds on add up to another 1,500. That's at least an order of magnitude smaller than existing native-code BEEP libraries.)
63 \subsection blipfeatures BLIP Features:
66 <li>Each message is very much like a MIME body, as in email or HTTP: it consists of a
67 blob of data of arbitrary length, plus a set of key/value pairs called "properties". The
68 properties are mostly ignored by BLIP itself, but clients can use them for metadata about the
69 body, and for delivery information (i.e. something like BEEP's "profiles".)
71 <li>Either peer can send a request at any time; there's no notion of "client" and "server" roles.
73 <li> Multiple messages can be transmitted simultaneously in the same direction over the same connection, so a very long
74 message does not block any other messages from being delivered. This means that message ordering
75 is a bit looser than in BEEP or HTTP 1.1: the receiver will see the beginnings of messages in the
76 same order in which the sender posted them, but they might not <i>end</i> in that same order. (For
77 example, a long message will take longer to be delivered, so it may finish after messages that
80 <li>The sender can indicate whether or not a message needs to be replied to; the response is tagged with the
81 identity of the original message, to make it easy for the sender to recognize. This makes it
82 straighforward to implement RPC-style (or REST-style) interactions. (Responses
83 cannot be replied to again, however.)
85 <li>A message can be flagged as "urgent". Urgent messages are pushed ahead in the outgoing queue and
86 get a higher fraction of the available bandwidth.
88 <li>A message can be flagged as "compressed". This runs its body through the gzip algorithm, ideally
89 making it faster to transmit. (Common markup-based data formats like XML and JSON compress
90 extremely well, at ratios up to 10::1.) The message is decompressed on the receiving end,
91 invisibly to client code.
93 <li>The implementation supports SSL connections (with optional client-side certificates), and Bonjour service advertising.
96 \section config Configuration
98 MYNetwork requires Mac OS X 10.5 or later, since it uses Objective-C 2 features like
99 properties and for...in loops.
101 MYNetwork uses my <a href="/hg/hgwebdir.cgi/MYUtilities">MYUtilities</a> library. You'll need to have downloaded that library, and added
102 the necessary source files and headers to your project. See the MYNetwork Xcode project,
103 which contains the minimal set of MYUtilities files needed to build MYUtilities. (That project
104 has its search paths set up to assume that MYUtilities is in a directory next to MYNetwork.)
106 \section download How To Get It
109 <li><a href="/hg/hgwebdir.cgi/MYNetwork/archive/tip.zip">Download the current source code</a>
110 <li>To check out the source code using <a href="http://selenic.com/mercurial">Mercurial</a>:
111 \verbatim hg clone /hg/hgwebdir.cgi/MYNetwork/ MYNetwork \endverbatim
112 <li>As described above, you'll also need to download or check out <a href="/hg/hgwebdir.cgi/MYUtilities">MYUtilities</a> and put it in
113 a directory next to MYNetwork.
116 Or if you're just looking:
119 <li><a href="/hg/hgwebdir.cgi/MYNetwork/file/tip">Browse the source code</a>
120 <li><a href="annotated.html">Browse the class documentation</a>
123 There isn't any conceptual documentation yet, beyond what's in the API docs, but you can
124 <a href="/hg/hgwebdir.cgi/MYNetwork/file/tip/BLIP/Demo/">look
125 at the sample BLIPEcho client and server</a>, which are based on Apple's
126 <a href="http://developer.apple.com/samplecode/CocoaEcho/index.html">CocoaEcho</a> sample code.