establishing a socket connection from iPhone to MAC/PC

Posted by user319572 on Stack Overflow See other posts from Stack Overflow or by user319572
Published on 2010-04-18T07:22:24Z Indexed on 2010/04/18 7:23 UTC
Read the original article Hit count: 602

Filed under:
|
|

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

© Stack Overflow or respective owner

Related posts about iphone

Related posts about socket