Skip to content

sjxjjx/HTTPServerDemo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CocoaHTTPServer

使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。

CocoaHTTPServer在这里就不多做介绍,如果没有的话,可以的GitHub上去下载:https://github.com/robbiehanson/CocoaHTTPServer。 下面开始简单介绍一下CocoaHTTPServer的使用。

步骤1:

CocoaHTTPServer框架中的文件导入项目中,需要的文件有:

  1. Core文件夹下所有文件
  2. Vendor文件夹下所有文件
  3. Samples -> SimpleFileUploadServer -> SimpleFileUploadServer -> MyHTTPConnection.h + MyHTTPConnection.m + web文件夹下所有文件

文件参考以下图片:

步骤2:

在 MyHTTPConnection.m 文件的 processStartOfPartWithHeader: 方法中,找到对应的地方,修改文件存储位置(这里以Document为例),如下图所示:

步骤3:

配置 httpServer。代码中有一个获取ip地址的方法,可以在网上搜,只要能获取到手机设备的ip地址就可以了,然后封装成一个工具类(SJXCSMIPHelper)。

现在就可以运行一下代码,如下图:

在网页输入ip地址和端口,就可以使用了。

博客地址:iOS项目之wifi局域网传输文件到iPhone的简单实现

About

使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published