views:

5268

answers:

2

I want to create an extremely simple iPhone program that will open a telnet session on a lan-connected device and send a sequence of keystrokes. Most of the code I've seen for sockets is overwhelming and vast overkill for what I want to do:

  1. open telnet socket to IP address
  2. send ascii keystrokes

Any simple code examples out there I can play with?

+11  A: 

I'd suggest you check out the Asyncsocket project:

It makes socket programming really easy; no messing with threads yourself and things happen asynchronously without much fuss.

I think there is a sample project with a client/server to get you started.

Andrew Pouliot
Thanks! I'm sure this will be helpful
Alan
how effective is this working with the 3g network? im rather new to this, but ive noticed that my socket-based programs often work perfectly fine over wifi but fail over 3g, and im at a loss as to the underlying reason for this.
blackkettle
If you're trying to connect directly to the iPhone's ip addr, you may be thwarted by a firewall or NAT. If the iPhone is the client connecting to your server, could be just dropped packets/timeout. You should post a specific question with the details of your problem.
Andrew Pouliot
A: 

Do yourself a favor: go read at least first 6 chapters of this Steven's book in which you can find plenty of simple examples and many advices how to avoid common pitfalls with network programming. Without doing that you will end with a buggy, slow and incomplete client.

Henry Flower
Thank you Henry.
Alan