+ NSLog(@"%s, h %@ p %@",gai_strerror(err),host,namedPort);
+ NSLog(ai?[self dumpv6Addrinfo:ai]:@"");
+ ai_cur = ai;
+ [self realDoConnection];
+}
+
+-(void)realDoConnection
+{
+ sockfd = socket(ai_cur->ai_family,SOCK_STREAM,IPPROTO_TCP);
+ [self spinoffReadLoop];
+}
+
+-(void)spinoffReadLoop
+{
+ NSPort *p1 = [NSPort port], *p2 = [NSPort port];
+ NSConnection *dcon = [[NSConnection alloc] initWithReceivePort:p1 sendPort:p2];
+ NSArray *par = [NSArray arrayWithObjects:p2,p1,nil];
+ [dcon setRootObject:delegate];
+ [NSThread detachNewThreadSelector:@selector(socketReadLoop:) toTarget:self withObject:par]; //spawn read thread
+}
+
+-(void)socketReadLoop:(id)data
+{
+ NSAutoreleasePool *ap = [[NSAutoreleasePool alloc] init];
+ NSConnection *dcon = [[NSConnection alloc] initWithReceivePort:[data objectAtIndex:0] sendPort:[data objectAtIndex:1]];
+ NSProxy *dp = [[dcon rootProxy] retain];
+ char *buf = malloc(bufs);
+ unsigned long readLen = 0,wpl = 0;
+ signed int err;
+ [readPipe setDelegate:(id <ITInetSocketDelegate>)dp];
+ if (nc){
+ NSLog(@"Connecting");
+ err = connect(sockfd,ai_cur->ai_addr,ai_cur->ai_addrlen);
+ if (err == -1)