Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to use NSStream class to create tcp connection iPhone
    text
    copied!<p>I need to send a string to a server on the same network with the iPad. when reading <a href="http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSStream_Class/Reference/Reference.html" rel="nofollow noreferrer">This</a> I found out that maybe I need to use the <code>+ getStreamsToHost:port:inputStream:outputStream:</code> method but I am not able use it. In xcode I have tried: </p> <pre><code>//Try 1 NSStream *myStream; //[myStream getStreamToHost// xcode cant find it] //Try 2 NSStream *myStream2 = [[NSStream alloc] init]; [myStream2 getStreamToHost// I have initialized it and yet xcode can't find the method //Try 3 [NSStream getStreamToHost] // does not work eather //Try 4 [[[NSStream alloc] init] getStreamToHost// does not work </code></pre> <p>and by the way I am listening on port 403 with a simple program called autoit let me show you how:</p> <p>I have two scripts (the client and the server); <img src="https://i.stack.imgur.com/UjRnH.png" alt="enter image description here"></p> <p>first I run the server and it starts listening. Then I run the client script and when that happens a message box appears and a song starts playing: <img src="https://i.stack.imgur.com/Y1M9p.png" alt="enter image description here"></p> <p>Let me show you the code it is very simple to understand just to show what's going on...</p> <p>the client code:</p> <p><img src="https://i.stack.imgur.com/NuVi9.png" alt="enter image description here"></p> <p>and the server code:</p> <p><img src="https://i.stack.imgur.com/dMPxJ.png" alt="enter image description here"></p> <p>note that the client sends the message hello and when that happens a message box appears <code>MsgBox(0,"Data Received", $TCPReceive)</code> and a song starts playing shellExecute("t.mp3") that mp3 file is on the same directory of the script. </p> <p>HOW CAN I SEND A SIMILAR MESSAGE BUT WITH AN IPHONE TO MY COMPUTER? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload