Sockets don't quite work, but they will almost work.
[ITFoundation.git] / ShowcaseController.m
index c1eef3c..d121bb6 100755 (executable)
@@ -8,28 +8,40 @@
 
 #import "ShowcaseController.h"
 #import "ITInetSocket.h"
+#import <Foundation/NSString.h>
+#import <SystemConfiguration/SystemConfiguration.h>
 
 
 @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:(ITInetSocket *)sender {
+    [sender disconnect];
+}
+
+- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender
+{
 }
 
-- (void) finishedConnecting:(in ITInetSocket *)sender {
-    NSLog(@"Done connectin'");
-    NSData *d = [NSData dataWithBytesNoCopy:"M00f!" length:5];
-    [sender->writePipe writeData:d];
+- (void) dataReceived:(ITInetSocket *)sender
+{
 }
-- (void) errorOccured:(ITInetSocketError)err during:(ITInetSocketState)state onSocket:(in ITInetSocket*)sender {NSLog(@"wtf");[sender retryConnection];}
-- (void) dataReceived:(in ITInetSocket *)sender
+
+- (void) newDataAdded:(ITByteStream*)sender
 {
-    ITByteStream *p = sender->readPipe;
-    NSData *d = [p readAllData];
-    NSLog(@"%@",d);
+
 }
 
+- (void)newClientJoined:(ITInetSocket*)client
+{
+    
+}
 @end