objective-c iPhone 插座程序

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1083017/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 21:51:46  来源:igfitidea点击:

iPhone socket program

iphoneobjective-csockets

提问by Alan

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:

我想创建一个非常简单的 iPhone 程序,它将在连接到 LAN 的设备上打开 telnet 会话并发送一系列按键。我见过的大多数套接字代码对于我想要做的事情来说都是压倒性的,而且是过度杀伤:

  1. open telnet socket to IP address
  2. send ascii keystrokes
  1. 打开 telnet 套接字到 IP 地址
  2. 发送 ASCII 击键

Any simplecode examples out there I can play with?

我可以使用任何简单的代码示例吗?

回答by Andrew Pouliot

I'd suggest you check out the Asyncsocket project:

我建议您查看Asyncsocket 项目

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.

我认为有一个带有客户端/服务器的示例项目可以帮助您入门。

回答by Alexander Gromnitsky

Do yourself a favor: go read at least first 6 chapters of thisSteven'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.

请你帮个忙:去阅读至少前6章的史蒂芬的书,从中可以找到很多简单的例子,许多建议如何避免网络编程常见的陷阱。如果不这样做,您将以有缺陷、缓慢且不完整的客户端结束。

回答by ios6

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

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

回答by tony gil

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

我不能在这里重新发布我的代码,因为 SO 认为重复您的回答是垃圾邮件。

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).

查看此示例代码和教程链接。就像一个魅力一样,而且非常容易实现,不到 3 分钟,你就可以开始了(如果你有一个套接字服务器准备好)。