TCP/TCPWriter.h
author Jens Alfke <jens@mooseyard.com>
Sat May 24 13:26:02 2008 -0700 (2008-05-24)
changeset 1 8267d5c429c4
child 2 9fdd8dba529c
permissions -rw-r--r--
Added #imports of utility headers, so source files will compile without requiring a custom prefix (MYUtilities.pch.)
jens@0
     1
//
jens@0
     2
//  TCPWriter.h
jens@0
     3
//  MYNetwork
jens@0
     4
//
jens@0
     5
//  Created by Jens Alfke on 5/10/08.
jens@0
     6
//  Copyright 2008 Jens Alfke. All rights reserved.
jens@0
     7
//
jens@0
     8
jens@0
     9
#import "TCPStream.h"
jens@0
    10
jens@0
    11
jens@0
    12
/** INTERNAL class that writes a queue of arbitrary data blobs to the socket. */
jens@0
    13
@interface TCPWriter : TCPStream 
jens@0
    14
{
jens@0
    15
    NSMutableArray *_queue;
jens@0
    16
    NSData *_currentData;
jens@0
    17
    SInt32 _currentDataPos;
jens@0
    18
}
jens@0
    19
jens@0
    20
/** The connection's TCPReader. */
jens@0
    21
@property (readonly) TCPReader *reader;
jens@0
    22
jens@0
    23
/** Schedules data to be written to the socket.
jens@0
    24
    Always returns immediately; the bytes won't actually be sent until there's room. */
jens@0
    25
- (void) writeData: (NSData*)data;
jens@0
    26
jens@0
    27
//protected:
jens@0
    28
jens@0
    29
/** Will be called when the internal queue of data to be written is empty.
jens@0
    30
    Subclasses should override this and call -writeData: to refill the queue,
jens@0
    31
    if possible. */
jens@0
    32
- (void) queueIsEmpty;
jens@0
    33
jens@0
    34
@end