CFSocketConnectToAddress and unrecognized selector sent to instance

Posted by madmik3 on Stack Overflow See other posts from Stack Overflow or by madmik3
Published on 2010-04-23T01:03:11Z Indexed on 2010/04/26 20:13 UTC
Read the original article Hit count: 337

Filed under:
|
|

Hello, I am somewhat new to iPhone dev and I have been getting unrecognized selector when I call CFSocketConnectToAddress in this code. I think it might be something basic that I am doing wrong. Any idea?

this is the complete error I get.

NSInvalidArgumentException unrecognized selector sent to instance 0x3922170

0x3922170 is the calling class.

- (BOOL)connect

{ CFSocketRef mySocket = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM,IPPROTO_UDP, 0, socketCallback, NULL);

@try {
    CFDataRef data = (CFDataRef)[_netService addresses]; 
    CFSocketConnectToAddress(mySocket, data, 500);

}
@catch (NSException * e) {
    NSLog([e name]);
    NSLog([e reason]);
}


//char joke[] = "Why did the chicken cross the road?";
//CFSocketError err = CFSocketSendData(mySocket, joke, (strlen(joke)+1), 10);
return true;

}

void socketCallback ( CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef address, const void *data, void *info) {

}

© Stack Overflow or respective owner

Related posts about iphone

Related posts about sockets