向 IP 地址和端口发送消息
过去几周我一直在努力解决这个问题。
我想要做的就是能够发送在 iphone/ipad 上创建的字符串并将其发送到特定的 IP 地址和端口号。然后该 IP 地址将返回“某些内容”,我想在 iphone/ipad 上显示一条消息。
我尝试过使用我遇到的示例项目,但永远无法让该死的东西发挥作用。我担心我会让这件事变得比实际需要的更加困难 - 但如果能提供一些帮助,我们将不胜感激。
谢谢萨姆
I have been trying get my head around this for last few weeks now.
All i want to do is be able to send a string created on the iphone/ipad and send that to a specific ip address and port number. That ip address will then return 'something' and i want to display a message back on the iphone/ipad.
I have tried using sample projects i came across , but can never get the damn thing to work. I fear i am making this alot harder than it needs to be - but some help would really be appreciated.
Thanks
Sam
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想将其发送到同一网络中的设备吗?我已修改 GKRocket 以发送字符串,然后将其显示在第二个设备的 UIAlert 中: 这是我的修改:
Do you want to send it to a device in the same network? I have modified GKRocket to send a string and then display it in a UIAlert in the second device: Here's my modification:
用户 NSURLConnection 类,您可以在以下位置找到参考
http://开发人员。 apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html
NSURLConnection 对象提供执行 URL 请求加载的支持。 NSURLConnection 的接口很稀疏,仅提供启动和取消 URL 请求异步加载的控件。
NSURLConnection 的委托方法允许对象接收有关 URL 请求异步加载的信息回调。其他委托方法提供了允许委托自定义执行异步 URL 加载过程的工具。
user NSURLConnection class, you can find referenece at
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html
An NSURLConnection object provides support to perform the loading of a URL request. The interface for NSURLConnection is sparse, providing only the controls to start and cancel asynchronous loads of a URL request.
NSURLConnection’s delegate methods allow an object to receive informational callbacks about the asynchronous load of a URL request. Other delegate methods provide facilities that allow the delegate to customize the process of performing an asynchronous URL load.