1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/TCP/TCPWriter.h Fri May 23 17:37:36 2008 -0700
1.3 @@ -0,0 +1,34 @@
1.4 +//
1.5 +// TCPWriter.h
1.6 +// MYNetwork
1.7 +//
1.8 +// Created by Jens Alfke on 5/10/08.
1.9 +// Copyright 2008 Jens Alfke. All rights reserved.
1.10 +//
1.11 +
1.12 +#import "TCPStream.h"
1.13 +
1.14 +
1.15 +/** INTERNAL class that writes a queue of arbitrary data blobs to the socket. */
1.16 +@interface TCPWriter : TCPStream
1.17 +{
1.18 + NSMutableArray *_queue;
1.19 + NSData *_currentData;
1.20 + SInt32 _currentDataPos;
1.21 +}
1.22 +
1.23 +/** The connection's TCPReader. */
1.24 +@property (readonly) TCPReader *reader;
1.25 +
1.26 +/** Schedules data to be written to the socket.
1.27 + Always returns immediately; the bytes won't actually be sent until there's room. */
1.28 +- (void) writeData: (NSData*)data;
1.29 +
1.30 +//protected:
1.31 +
1.32 +/** Will be called when the internal queue of data to be written is empty.
1.33 + Subclasses should override this and call -writeData: to refill the queue,
1.34 + if possible. */
1.35 +- (void) queueIsEmpty;
1.36 +
1.37 +@end