X-Git-Url: http://git.ithinksw.org/ITFoundation.git/blobdiff_plain/c9e0098808889b595086f244439485d1787f65ee..af1fcfcf8c78f03127d3929b49330cc191259487:/ShowcaseController.m?ds=sidebyside diff --git a/ShowcaseController.m b/ShowcaseController.m index c1eef3c..a9aff62 100755 --- a/ShowcaseController.m +++ b/ShowcaseController.m @@ -8,28 +8,36 @@ #import "ShowcaseController.h" #import "ITInetSocket.h" +#import +#import @implementation ShowcaseController - (void)awakeFromNib { - - ITInetSocket *sock = [[ITInetSocket alloc] initWithDelegate:self]; - NSLog(@"rawr?"); - [sock connectToHost:@"66.111.58.80" onPort:4336]; + server = [[ITInetServerSocket alloc] initWithDelegate:self]; + [server setPort:1338]; + [server setServiceType:@"ittest" useForPort:NO]; + [server setServiceName:[(NSString*)SCDynamicStoreCopyComputerName(NULL,NULL) autorelease]]; + [server start]; + [ITInetSocket startAutoconnectingToService:@"ittest" delegate:self]; } -- (void) finishedConnecting:(in ITInetSocket *)sender { - NSLog(@"Done connectin'"); - NSData *d = [NSData dataWithBytesNoCopy:"M00f!" length:5]; - [sender->writePipe writeData:d]; +- (void) finishedConnecting:(ITInetSocket *)sender { + [[sender writePipe] writeBytes:"suck" len:4]; } -- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender {NSLog(@"wtf");[sender retryConnection];} -- (void) dataReceived:(in ITInetSocket *)sender + +- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender { - ITByteStream *p = sender->readPipe; - NSData *d = [p readAllData]; - NSLog(@"%@",d); } +- (void) newDataAdded:(ITByteStream*)sender +{ + +} + +- (void)newClientJoined:(ITInetSocket*)client +{ + [[client writePipe] writeBytes:"suck" len:4]; +} @end