iPhone socket program

2019-01-16 17:00发布

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?

4条回答
我命由我不由天
2楼-- · 2019-01-16 17:29

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.

查看更多
一夜七次
3楼-- · 2019-01-16 17:35

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.

查看更多
老娘就宠你
4楼-- · 2019-01-16 17:40

i cant repost my code here, because SO considers it spamming to repeat your answer.

check out this sample code and tutorial link. works like a charm and is really simple to implement, less than 3 minutes and you are up and going (IF you have a socket server ready).

查看更多
戒情不戒烟
5楼-- · 2019-01-16 17:42

Go through this you will have to get basic idea of socket programming

http://ichuiphonedev.blogspot.in/2012/07/a-basic-idea-of-socket-programming-in.html

查看更多
登录 后发表回答