Hi everyone.
My app opens a telnet-like connection to a home automation device, and communicates with that device by sending and receiving short data packets. In order to open an NSInputStream and NSOutput stream to the device at a known host address and port, I'm using code like this....
// Elsewhere in the code... NSString *hostAddr; NSInputStream *iStream; NSOutputStream *oStream;
...
// create the i/o streams CFStreamCreatePairWithSocketToHost(kCFAllocatorDefault,(CFStringRef)hostAddr,40 01,(CFReadStreamRef)&iStream,(CFWriteStreamRef)&oStream); [iStream retain]; [oStream retain];
This is all good, and works very well for me.
The issue is that NSInputStream and NSOutputStream are supposed to be 'toll free bridged' to their CoreFoundation counterparts (CFReadStreamRef and CRWriteStreamRef). However when I build the code I always get these warnings:
warning: passing argument 4 of 'CFStreamCreatePairWithSocketToHost' from incompatible pointer type. warning: passing argument 5 of 'CFStreamCreatePairWithSocketToHost' from incompatible pointer type.
Am I casting these calls wrongly or is there some other method I should use to open a telnet like socket based connection? Like I say, the code actually works really well, I'd just love to get rid of the warnings.
Regards, -Kenny |