xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
HttpServer.xcs
浏览该文件的文档.
1
5@Declare
6static class HttpServer{
7
11 static const int DEFAULT_MODEL = 0;
12
16 static const int SELECT_MODEL = 1;
17
21 static const int POLL_MODEL = 2;
22
26 static const int EPOLL_MODEL = 3;
27
32
33
37 bool setMaxConnection(int n);
38
42 bool setConnectionTimeout(int millisec);
43
48
52 bool setThreadPoolSize(int n);
53
60 int addWebsite(String domains, Website website);
61
65 void quiesce();
66
70 void close();
71
72
80 bool startServer(int flags, int port);
81
89 bool configHttps(bool enable, String cert, String key);
90
94 void finalize();
95};
HTTP 服务器
bool setMaxConnection(int n)
限制服务器的最大连接数为N 小于等于0 为不限制
static const int DEFAULT_MODEL
默认网络模型运行, 一般为EPOLL_MODEL
bool configHttps(bool enable, String cert, String key)
设置启用https
int addWebsite(String domains, Website website)
添加网站
void finalize()
清理工作 ,注意 继承对象并重写了finalize 必须使用super.finalize 以免内核对象泄露
bool setConnectionTimeout(int millisec)
限制链接的最大超时 小于等于0 为不限制
bool setIpConnectionLimit(int n)
限制单IP最大连接数为N 小于等于0 为不限制
void close()
关闭服务器
static const int SELECT_MODEL
以select网络模型运行
static const int EPOLL_MODEL
以epoll网络模型运行
static const int POLL_MODEL
以poll网络模型运行
bool setThreadPoolSize(int n)
设置线程池的预备大小
void quiesce()
停止服务器接受新的链接, 但不影响已有链接
bool startServer(int flags, int port)
开启服务器
HttpServer()
构造
字符串类
http 站点类