Need some direction on network app

Discussion in 'iOS Programming' started by RonC, Jan 27, 2012.

  1. RonC macrumors regular

    Joined:
    Oct 18, 2007
    Location:
    Chicago-area
    #1
    I've been asked to build an app that communicates with a set of Linux servers, each of which is connected to a piece of test equipment. Think of it as one place to see the stats from N different instances of the same piece of test equipment.

    These stats are generated frequently (every 1 second), and that is the update rate for the presentation. The app's job, therefore, is to present a unified view of the information from those pieces of test equipment such that the suits can see it whenever they'd like to have a look.

    Notwithstanding the complexities of that last part of the requirement, I'm looking for some sample code that I can use to understand network coding on iOS. I'm experienced with socket programming in Linux.

    I have a protocol that I have to comply with that is UDP-based, I know the IP address and port numbers that I can use, I know how to implement the protocol at a behavioral level. The protocol itself is quite simple with a limited number of commands/responses.

    What I don't know is how to do that stuff on iOS. Are there any good examples beyond the Apple sample code (I'm looking at the WiTap and MVCNetworking examples right now)? Any gotchas that I should be looking out for? Any idioms that are useful?

    I know it's a pretty open ended question, but I'm appreciative of any help you can provide.
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    Here's how I'd do this.

    Write a data-summarizer that runs on Linux. It uses the required UDP protocol, and contacts all the servers. It does the updates every second, or however often you like. Since you already know how to do this on Linux (as I interpret your post), it shouldn't be that hard to get it going.

    It writes a single file, say in JSON text. It then serves that file using a simple HTTP service. Or it puts the JSON file onto an existing HTTP server, at some designated URL.

    Now you can write a simple web app that resides on the same HTTP server, and simply uses JavaScript to read the summarized-data file, parse it, and display the results using HTML, CSS, and JavaScript. The XMLHttpRequest*JavaScript*object will play a pivotal role in this.

    If you write the summarized-data file as XML instead of JSON, then XMLHttpRequest will even parse the file for you. Not that it's hard to find JSON parsers.

    One advantage of a plain ordinary web app is that any sufficiently capable web browser will be able to display the page. And the bar for "sufficiently capable" won't be that hard to meet. It won't be limited to iOS devices, either.

    Other advantages are you won't have to get approval from Apple to distribute (or update) your app, and your company won't have to buy an Enterprise Developer account.
     
  3. RonC thread starter macrumors regular

    Joined:
    Oct 18, 2007
    Location:
    Chicago-area
    #3
    Thanks!

    I was so locked in on the app doing all the hard work when really I can have it be simpler with the hard work in a more comfortable (for me) environment.

    I have a draft app in a functioning state (it's not the prettiest or smoothest, but it does work) so I'm spending the next week working on the other side of the system to get everything working by the end of the week.
     

Share This Page