如何通过wifi从iphone发送数据到应用程序,打印消息 [英] how to send data from iphone over wifi to application, to print message

查看:162
本文介绍了如何通过wifi从iphone发送数据到应用程序,打印消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何执行以下操作:

i would like to know how to do the following:

第1步:如何将以下字符串从iphone发送到当用户按下按钮时,通过WIFI使用mac计算机。

step 1: how to send the following string from the iphone to a mac computer via WIFI when a user presses a button.

要发送的字符串:hello。

string to be sent: "hello".

step2:如何使用我必须创建的应用程序接收该字符串。这将非常简单。它将没有界面,除了它只打印出消息。

step2: how to receive that string with an application i would have to create. it will be very simple. it will have no interface, except it will just print out the message.

我如何实现这样的目标。我从未使用iphone编程通过WIFI发送信号。有人可以指导我吗?

How do i achieve something like this. I've never sent a signal over WIFI with the iphone programming. Can someone guide me please?

推荐答案

我会引用一个类似的问题:

I'll quote myself from a similar question:

如何创建一个从iOS应用程序通过WiFi网络接收数据的小型Mac应用程序?

使用CFNetwork框架,您可以使用bonjour进行发现,然后通过本机套接字来处理持久连接,以便来回传递数据。

Using the CFNetwork framework, you can use bonjour for discovery and then handle a persistent connection through native sockets for passing data back and forth.

http://developer.apple.com/library/ios/#documentation/Networking/Conceptual/CFNetwork/Introduction /Introduction.html

这是一个很好的入门教程,适用于iOS,但CFNetwork也可以在OS X中使用。

Here is an excellent tutorial to get started, its for iOS but CFNetwork is available in OS X too.

http://mobileorchard.com/tutorial-networking-and-bonjour-on-iphone

这篇关于如何通过wifi从iphone发送数据到应用程序,打印消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆