maindocs.h
author Jens Alfke <jens@mooseyard.com>
Wed Jun 11 14:58:38 2008 -0700 (2008-06-11)
changeset 16 6f608b552b77
parent 5 2c4bb6968927
child 27 92581f26073e
permissions -rw-r--r--
* 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.
jens@2
     1
//
jens@2
     2
//  maindocs.h
jens@2
     3
//  MYNetwork
jens@2
     4
//
jens@2
     5
//  Created by Jens Alfke on 5/24/08.
jens@2
     6
//  Copyright 2008 Jens Alfke. All rights reserved.
jens@2
     7
//
jens@2
     8
// This file just contains the Doxygen comments that generate the main (index.html) page content.
jens@2
     9
jens@2
    10
jens@5
    11
/*! \mainpage MYNetwork: Mooseyard Networking Library, With BLIP Protocol Implementation
jens@5
    12
 
jens@5
    13
    <center><b>By <a href="/Jens/">Jens Alfke</a></b></center>
jens@8
    14
jens@8
    15
    <img src="BLIP.png">
jens@8
    16
jens@4
    17
\section intro_sec Introduction
jens@2
    18
 
jens@2
    19
    MYNetwork is a set of Objective-C networking classes for Cocoa applications on Mac OS X.
jens@2
    20
    It consists of:
jens@2
    21
    <ul>
jens@2
    22
    <li>Networking utility classes (presently only IPAddress);
jens@2
    23
    <li>A generic TCP client/server implementation,
jens@2
    24
        useful for implementing your own network protocols; (see TCPListener and TCPConnection)
jens@5
    25
    <li>An implementation of <a href="#blipdesc">BLIP</a>, a lightweight network protocol I've invented as an easy way
jens@2
    26
        to send request and response messages between peers. (see BLIPListener, BLIPConnection, BLIPRequest, etc.)
jens@2
    27
    </ul>
jens@2
    28
 
jens@5
    29
\section license License and Disclaimer
jens@5
    30
 
jens@5
    31
 MYNetwork is released under a BSD license, which means you can freely use it in open-source
jens@5
    32
 or commercial projects, provided you give credit in your documentation or About box.
jens@5
    33
 
jens@5
    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.
jens@5
    35
 
jens@5
    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.)
jens@5
    37
 
jens@5
    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.
jens@5
    39
 
jens@5
    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!
jens@4
    41
jens@4
    42
\section blipdesc What's BLIP?
jens@2
    43
 
jens@8
    44
 <table style="background-color: #fff; padding: 5px; float: right" cellspacing=0>
jens@8
    45
 <tr><td>
jens@8
    46
 <img src="http://groups.google.com/groups/img/3nb/groups_bar.gif"
jens@8
    47
 height=26 width=132 alt="Google Groups">
jens@8
    48
 </td></tr>
jens@8
    49
 <tr><td style="padding-left: 5px;font-size: 125%">
jens@8
    50
 <b>BLIP Protocol</b>
jens@8
    51
 </td></tr>
jens@8
    52
 <tr><td style="padding-left: 5px">
jens@8
    53
 <a href="http://groups.google.com/group/blip-protocol">Visit this group</a>
jens@8
    54
 </td></tr>
jens@8
    55
 </table>
jens@8
    56
 
jens@4
    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. 
jens@4
    58
 
jens@4
    59
BLIP was inspired by <a
jens@4
    60
href="http://beepcore.org">BEEP</a> (in fact BLIP stands for "BEEP-LIke Protocol") but is
jens@5
    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.)
jens@4
    62
 
jens@4
    63
\subsection blipfeatures BLIP Features:
jens@4
    64
jens@4
    65
 <ul>
jens@4
    66
 <li>Each message is very much like a MIME body, as in email or HTTP: it consists of a
jens@4
    67
blob of data of arbitrary length, plus a set of key/value pairs called "properties". The
jens@4
    68
properties are mostly ignored by BLIP itself, but clients can use them for metadata about the
jens@4
    69
body, and for delivery information (i.e. something like BEEP's "profiles".)
jens@4
    70
jens@4
    71
<li>Either peer can send a request at any time; there's no notion of "client" and "server" roles.
jens@4
    72
 
jens@4
    73
<li> Multiple messages can be transmitted simultaneously in the same direction over the same connection, so a very long
jens@4
    74
message does not block any other messages from being delivered. This means that message ordering
jens@4
    75
is a bit looser than in BEEP or HTTP 1.1: the receiver will see the beginnings of messages in the
jens@4
    76
same order in which the sender posted them, but they might not <i>end</i> in that same order. (For
jens@4
    77
example, a long message will take longer to be delivered, so it may finish after messages that
jens@4
    78
were begun after it.)
jens@4
    79
jens@4
    80
<li>The sender can indicate whether or not a message needs to be replied to; the response is tagged with the
jens@4
    81
identity of the original message, to make it easy for the sender to recognize. This makes it
jens@4
    82
straighforward to implement RPC-style (or REST-style) interactions. (Responses
jens@4
    83
cannot be replied to again, however.)
jens@4
    84
jens@4
    85
<li>A message can be flagged as "urgent". Urgent messages are pushed ahead in the outgoing queue and
jens@4
    86
get a higher fraction of the available bandwidth.
jens@4
    87
jens@4
    88
<li>A message can be flagged as "compressed". This runs its body through the gzip algorithm, ideally
jens@4
    89
making it faster to transmit. (Common markup-based data formats like XML and JSON compress
jens@4
    90
extremely well, at ratios up to 10::1.) The message is decompressed on the receiving end,
jens@4
    91
invisibly to client code.
jens@4
    92
 
jens@4
    93
<li>The implementation supports SSL connections (with optional client-side certificates), and Bonjour service advertising.
jens@4
    94
</ul>
jens@8
    95
  
jens@4
    96
\section config Configuration
jens@2
    97
 
jens@2
    98
    MYNetwork requires Mac OS X 10.5 or later, since it uses Objective-C 2 features like
jens@2
    99
    properties and for...in loops.
jens@2
   100
 
jens@2
   101
    MYNetwork uses my <a href="/hg/hgwebdir.cgi/MYUtilities">MYUtilities</a> library. You'll need to have downloaded that library, and added
jens@2
   102
    the necessary source files and headers to your project. See the MYNetwork Xcode project,
jens@2
   103
    which contains the minimal set of MYUtilities files needed to build MYUtilities. (That project
jens@2
   104
    has its search paths set up to assume that MYUtilities is in a directory next to MYNetwork.)
jens@2
   105
jens@4
   106
\section download How To Get It
jens@2
   107
jens@2
   108
    <ul>
jens@4
   109
    <li><a href="/hg/hgwebdir.cgi/MYNetwork/archive/tip.zip">Download the current source code</a>
jens@2
   110
    <li>To check out the source code using <a href="http://selenic.com/mercurial">Mercurial</a>:
jens@4
   111
    \verbatim hg clone /hg/hgwebdir.cgi/MYNetwork/ MYNetwork \endverbatim
jens@4
   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 
jens@4
   113
    a directory next to MYNetwork.
jens@2
   114
    </ul>
jens@2
   115
jens@2
   116
    Or if you're just looking:
jens@2
   117
jens@2
   118
    <ul>
jens@4
   119
    <li><a href="/hg/hgwebdir.cgi/MYNetwork/file/tip">Browse the source code</a>
jens@2
   120
    <li><a href="annotated.html">Browse the class documentation</a>
jens@2
   121
    </ul>
jens@2
   122
 
jens@4
   123
    There isn't any conceptual documentation yet, beyond what's in the API docs, but you can 
jens@4
   124
    <a href="/hg/hgwebdir.cgi/MYNetwork/file/tip/BLIP/Demo/">look
jens@4
   125
    at the sample BLIPEcho client and server</a>, which are based on Apple's 
jens@4
   126
    <a href="http://developer.apple.com/samplecode/CocoaEcho/index.html">CocoaEcho</a> sample code.
jens@4
   127
 
jens@2
   128
 */