Using Cocoahttpserver to build a mobile phone local server

Source: Internet
Author: User
Principle

Using the Cocoahttpserver framework, a local server is established on the iOS side, so long as the computer and mobile phone are connected to the same hotspot or network, the pages of the iOS server can be accessed via the Computer browser, and the file upload is implemented with post.

Realize

1. Download Cocoahttpserver

2. Import the CocoaHTTPServer-master Core folder under the directory

3. Import the Samples/SimpleFileUploadServer MyHTTPConnection class files and folders under the directory web

When importing Web folders, be sure to use the real directory instead of the Xcode virtual directory

4. Configure the server startup in the appropriate place. Here take Appdelegate as an example

5. After running, the console will print out the port number and IP, in the computer-side browser input ip+ port number access, if successful, you will see the following interface:

Access succeeded. png

6. If the upload is successful, the uploaded file name will appear on the webpage, and you can verify the file upload success in the sandbox.

(There are many forms of uploaded files, pictures, text, video can be, remember that the computer and mobile phone connected to the same hotspot or network)

Give me a chestnut: https://pan.baidu.com/s/1jIf95u2

Using Cocoahttpserver to build a mobile phone local server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.