establishing a socket connection from iPhone to MAC/PC
- by user319572
Hello,
I just started getting into XCode and Co. What I am trying is to send accelerometer data via WLAN to a PC or MAC over a Socket connection. I am trying at the moment with the iPhone simulator, on the other site a netbook with a JAVA program shall receive a test string for starters. Unfortunately my socket will not initialize. What am I doing wrong?
NSString *recStr = @"192.168.0.5"; //String with receiver IP
NSHost *hoster = [NSHost hostWithName:recStr]; //create a host
NSOutputStream *sendData; //create an output stream
[NSStream getStreamsToHost:hoster port:8000 inputStream:nil outputStream:&sendData];
[sendData retain];
[sendData setDelegate:self];
[sendData open];
A warning says NSStream may not respond to '+getStreamsToHost:inputSream:outputStream:'
So I guess parameters are wrong. But why and how to do it right? The program starts but I don't think I can send anything as long as this warning shows up (have not tried though).
Thank you in advance,
Andreas