如何将数据从Visual C ++应用程序发送到iPhone应用程序?

时间:2021-09-23 01:44:18

This question must be really basic, but if you have any pointers I would really appreciate any help!

这个问题必须非常基本,但如果你有任何指示我真的很感激任何帮助!

I have a Windows development project in Visual C++, and would like to send binary data (images mostly, but also other stuff) to an iPhone app over the Internet.

我在Visual C ++中有一个Windows开发项目,并希望通过Internet将二进制数据(主要是图像,还有其他东西)发送到iPhone应用程序。

What is the simplest way you know how to do this? Should I use HTTP and NSUrlConnection on the iPhone, and some framework library (which?) to set up a web server inside my Visual C++ application? Or do I need to setup a proper web server like Apache (and how do I have my C++ application communicate with it then??)

你知道如何做到这一点最简单的方法是什么?我应该在iPhone上使用HTTP和NSUrlConnection,还有一些框架库(哪个?)在我的Visual C ++应用程序中设置Web服务器?或者我是否需要设置一个像Apache这样的合适的Web服务器(以及如何让我的C ++应用程序与它通信呢?)

So you see I am totally clueless about web technologies... if you think there is no helping me I'd appreciate book recommendations as well :)

所以你看到我对网络技术完全无能为力......如果你认为没有帮助我,我也会感谢书籍建议:)

Thanks a lot and cheers

非常感谢和欢呼

3 个解决方案

#1


0  

Not sure a web server in your C++ application is the best idea. I would implement a simple external web server in php/java/choose your poison. I would put the web server in some hosting service on a domain I would purchase. And then of course use HTTP to manage the communication between the two. The C++ application would upload images via HTTP to the web server, and the iphone app would download them via HTTP.

不确定C ++应用程序中的Web服务器是最好的主意。我会在php / java中实现一个简单的外部Web服务器/选择你的毒药。我会将Web服务器放在我要购买的域上的某些托管服务中。然后当然使用HTTP来管理两者之间的通信。 C ++应用程序将通过HTTP将图像上传到Web服务器,而iphone应用程序将通过HTTP下载它们。

Also, if you don't want to purchase a hosting service / domain, take a look at services like Google AppEngine which is free as long as you don't overuse it.

此外,如果您不想购买托管服务/域名,请查看Google AppEngine等免费服务,只要您不过度使用它。

Check this question for making HTTP requests from C++: How do you make a HTTP request with C++?

检查此问题是否从C ++发出HTTP请求:如何使用C ++发出HTTP请求?

#2


1  

Another idea can be to use some cloud storage service like DropBox. This service allows you to save files and access them using HTTP. DropBox is also free if you only need 2GB.

另一个想法是使用像DropBox这样的云存储服务。此服务允许您使用HTTP保存文件并访问它们。如果您只需要2GB,DropBox也是免费的。

They have API for uploading/downloading files for several platforms here: http://www.dropbox.com/developers/reference/sdk

他们有用于上传/下载多个平台文件的API:http://www.dropbox.com/developers/reference/sdk

Unfortunately, they do not have an API in C++. But since DropBox is just based on HTTP, you should be able to use libcurl or any other HTTP library for this. This guy ran into some difficulties Using libcurl to upload files to DropBox (without answer though, but shouldn't be too hard to overcome)

不幸的是,它们没有C ++中的API。但由于DropBox仅基于HTTP,因此您应该能够使用libcurl或任何其他HTTP库。这家伙遇到了一些困难使用libcurl将文件上传到DropBox(虽然没有回答,但不应该太难克服)

#3


0  

This should get you started on writing a PHP web service with a mysql DB and having an iOS app accessing it: http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app

这应该让您开始使用mysql DB编写PHP Web服务并使用iOS应用程序访问它:http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service - 用于-AN-IOS应用内

this is about half the fun, the other half is basically doing the same thing with c++ (with libcurl or something similar)

这大约是一半的乐趣,另一半基本上用c ++做同样的事情(使用libcurl或类似的东西)

#1


0  

Not sure a web server in your C++ application is the best idea. I would implement a simple external web server in php/java/choose your poison. I would put the web server in some hosting service on a domain I would purchase. And then of course use HTTP to manage the communication between the two. The C++ application would upload images via HTTP to the web server, and the iphone app would download them via HTTP.

不确定C ++应用程序中的Web服务器是最好的主意。我会在php / java中实现一个简单的外部Web服务器/选择你的毒药。我会将Web服务器放在我要购买的域上的某些托管服务中。然后当然使用HTTP来管理两者之间的通信。 C ++应用程序将通过HTTP将图像上传到Web服务器,而iphone应用程序将通过HTTP下载它们。

Also, if you don't want to purchase a hosting service / domain, take a look at services like Google AppEngine which is free as long as you don't overuse it.

此外,如果您不想购买托管服务/域名,请查看Google AppEngine等免费服务,只要您不过度使用它。

Check this question for making HTTP requests from C++: How do you make a HTTP request with C++?

检查此问题是否从C ++发出HTTP请求:如何使用C ++发出HTTP请求?

#2


1  

Another idea can be to use some cloud storage service like DropBox. This service allows you to save files and access them using HTTP. DropBox is also free if you only need 2GB.

另一个想法是使用像DropBox这样的云存储服务。此服务允许您使用HTTP保存文件并访问它们。如果您只需要2GB,DropBox也是免费的。

They have API for uploading/downloading files for several platforms here: http://www.dropbox.com/developers/reference/sdk

他们有用于上传/下载多个平台文件的API:http://www.dropbox.com/developers/reference/sdk

Unfortunately, they do not have an API in C++. But since DropBox is just based on HTTP, you should be able to use libcurl or any other HTTP library for this. This guy ran into some difficulties Using libcurl to upload files to DropBox (without answer though, but shouldn't be too hard to overcome)

不幸的是,它们没有C ++中的API。但由于DropBox仅基于HTTP,因此您应该能够使用libcurl或任何其他HTTP库。这家伙遇到了一些困难使用libcurl将文件上传到DropBox(虽然没有回答,但不应该太难克服)

#3


0  

This should get you started on writing a PHP web service with a mysql DB and having an iOS app accessing it: http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service-for-an-ios-app

这应该让您开始使用mysql DB编写PHP Web服务并使用iOS应用程序访问它:http://www.raywenderlich.com/2941/how-to-write-a-simple-phpmysql-web-service - 用于-AN-IOS应用内

this is about half the fun, the other half is basically doing the same thing with c++ (with libcurl or something similar)

这大约是一半的乐趣,另一半基本上用c ++做同样的事情(使用libcurl或类似的东西)