I've build a small experimental iOS app on iphone.
It connects to a external device server (running on ubuntu) through telnet (23) over WiFi. After port is open the app sends user name password to authenticate on remote server. After successful authentication it goes to a prompt where special character is displayed "in this case it's a $ sign".
At this point I'm able to run any set of commands which I assigned on button press, it's working fine.
Note: there are two types of commands one sends the command and don't rely on acknowledgement from server, another sends the command and rely on feedback from the server to perform another following action or display result on the screen.
1) When a command send to server to perform some task and get the feedback from the server, app reads the NSStream coming from server and shows the output to user, however this reading from the stream is inconsistent around 40% of the time during my tests.
2) Sometime app also get data on NSStream which was triggered by events internal to server, based on that data my app need to perform certain action (for example a alarm on server triggered, server send that data on NSStream - I'm getting the data but again it's inconsistent)
I'm receiving full value of data on NSStream, however I'm unable to read it properly because sometime its scattered, in multiple lines etc.
Resolution & Scope of Work:
A script which reads NSStream and pickup data of interest.
Server send feedback after every command completion a code like "ok,00" for success, "error,09" for error etc.
Server allow differentiation between command output and the completion code output, a single newline is always inserted between the last line of command output and the completion code.
I want to read these values which is available on NSStream consistently.
Thanks for reading so far and showing interest in it.