https://github.com/sjxjjx/HTTPServerDemo
使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。
https://github.com/sjxjjx/HTTPServerDemo
Last synced: 3 months ago
JSON representation
使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。
- Host: GitHub
- URL: https://github.com/sjxjjx/HTTPServerDemo
- Owner: sjxjjx
- License: mit
- Created: 2017-11-28T03:32:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-31T03:34:27.000Z (over 5 years ago)
- Last Synced: 2023-10-19T19:25:54.282Z (over 1 year ago)
- Language: Objective-C
- Homepage:
- Size: 187 KB
- Stars: 31
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - HTTPServerDemo - 使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。 (OOM-Leaks-Crash / WiFi File Transfer)
README
# CocoaHTTPServer
## 使用CocoaHTTPServer框架实现wifi局域网传输文件到iPhone的功能。
CocoaHTTPServer在这里就不多做介绍,如果没有的话,可以的GitHub上去下载:[https://github.com/robbiehanson/CocoaHTTPServer](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的简单实现](https://www.cnblogs.com/sjxjjx/p/7430027.html)