#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:@"irc.freenode.net" onPort:6667];
+ 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 {
- NSString *ircini = @"NICK ITFTest\r\nUSER m0nk3ys . . :Not Tellin'\r\nJOIN #iThink\r\nPRIVMSG #iThink :w00t\r\nQUIT :!\r\n";
- NSLog(@"Done connectin'");
- NSData *d = [NSData dataWithBytes:[ircini cString] length:[ircini length]];
- [sender->writePipe writeData:d];
- NSLog(@"%@",sender->writePipe->data);
+- (void) finishedConnecting:(ITInetSocket *)sender {
+ [sender disconnect];
}
-- (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
+{
+}
+
+- (void) dataReceived:(ITInetSocket *)sender
+{
+}
+
+- (void) newDataAdded:(ITByteStream*)sender
{
- ITByteStream *p = sender->readPipe;
- NSData *d = [p readAllData];
- NSLog(@"%@",d);
+
}
+- (void)newClientJoined:(ITInetSocket*)client
+{
+
+}
@end