轻量的HTTP server GCDWebServer

码农软件 · 软件分类 · 其他(Others) · 2019-07-24 16:57:04

软件介绍

由swisspol提供的开源库GCDWebServer是一个轻量的HTTP server,它基于 GCD 并可用于 OS X & iOS,该库还实现了基于web的文件上传以及 WebDAV server等扩展功能。

使用方法:

#import "GCDWebServer.h"
#import "GCDWebServerDataResponse.h"

static GCDWebServer* _webServer = nil;  // This should really be an ivar of your application's delegate class

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

  // Create server
  _webServer = [[GCDWebServer alloc] init];

  // Add a handler to respond to GET requests on any URL
  [_webServer addDefaultHandlerForMethod:@"GET"
                            requestClass:[GCDWebServerRequest class]
                            processBlock:^GCDWebServerResponse *(GCDWebServerRequest* request) {

    return [GCDWebServerDataResponse responseWithHTML:@"<html><body><p>Hello World</p></body></html>"];

  }];

  // Start server on port 8080
  [_webServer startWithPort:8080 bonjourName:nil];

  return YES;
}

本文地址:https://codercto.com/soft/d/10848.html

Building Social Web Applications

Building Social Web Applications

Gavin Bell / O'Reilly Media / 2009-10-1 / USD 34.99

Building a social web application that attracts and retains regular visitors, and gets them to interact, isn't easy to do. This book walks you through the tough questions you'll face if you're to crea......一起来看看 《Building Social Web Applications》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

在线进制转换器
在线进制转换器

各进制数互转换器

MD5 加密
MD5 加密

MD5 加密工具