TCP/TCPWriter.h
author Jens Alfke <jens@mooseyard.com>
Mon Jul 20 13:26:29 2009 -0700 (2009-07-20)
changeset 59 46c7844cb592
parent 0 9d67172bb323
permissions -rw-r--r--
* MYBonjourBrowser: Added delegate (no methods for it yet, just for client use.)
* MYBonjourRegistration: Added +canonicalFormOfTXTRecordDictionary:.
* MYBonjourService: Added back-reference to browser.
* IPAddress: Added conversions to/from struct sockaddr.
     1 //
     2 //  TCPWriter.h
     3 //  MYNetwork
     4 //
     5 //  Created by Jens Alfke on 5/10/08.
     6 //  Copyright 2008 Jens Alfke. All rights reserved.
     7 //
     8 
     9 #import "TCPStream.h"
    10 
    11 
    12 /** Output stream for a TCPConnection. Writes a queue of arbitrary data blobs to the socket. */
    13 @interface TCPWriter : TCPStream 
    14 {
    15     NSMutableArray *_queue;
    16     NSData *_currentData;
    17     SInt32 _currentDataPos;
    18 }
    19 
    20 /** The connection's TCPReader. */
    21 @property (readonly) TCPReader *reader;
    22 
    23 /** Schedules data to be written to the socket.
    24     Always returns immediately; the bytes won't actually be sent until there's room. */
    25 - (void) writeData: (NSData*)data;
    26 
    27 //protected:
    28 
    29 /** Will be called when the internal queue of data to be written is empty.
    30     Subclasses should override this and call -writeData: to refill the queue,
    31     if possible. */
    32 - (void) queueIsEmpty;
    33 
    34 @end