00001
00002
00003
00004
00005
00006
00007
00008
00009 #import "ServerReaderTcp.h"
00010
00011 @implementation ServerReaderTcp
00012
00013 ONSocketStream *stream;
00014
00015 - (id) init {
00016 self = [super init];
00017 if (self != nil) {
00018 stream = nil;
00019 }
00020 return self;
00021 }
00022
00023 - (id)initWithUniverse:(Universe*)newUniverse communication:(Communication*)comm
00024 socket:(ONTCPSocket*) socket {
00025
00026 self = [super initWithUniverse:newUniverse communication:comm];
00027 if (self != nil) {
00028
00029 stream = [ONSocketStream streamWithSocket:socket];
00030 [stream retain];
00031 }
00032 return self;
00033 }
00034
00035 - (NSData *) doRead {
00036
00037 NSData *result = [stream readDataWithMaxLength:1536];
00038 return result;
00039 }
00040
00041 - (void) close {
00042 [stream release];
00043 stream = nil;
00044 }
00045
00046 @end