Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
a994e075
Commit
a994e075
authored
May 05, 2017
by
xiongziliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test for telnet
parent
56078f3b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
2 行删除
+19
-2
tests/test_server.cpp
+19
-2
没有找到文件。
tests/test_server.cpp
查看文件 @
a994e075
...
@@ -25,12 +25,14 @@
...
@@ -25,12 +25,14 @@
#include "Poller/EventPoller.h"
#include "Poller/EventPoller.h"
#include "Thread/WorkThreadPool.h"
#include "Thread/WorkThreadPool.h"
#include "Device/PlayerProxy.h"
#include "Device/PlayerProxy.h"
#include "Shell/ShellSession.h"
#include <map>
#include <map>
using
namespace
std
;
using
namespace
std
;
using
namespace
ZL
::
Util
;
using
namespace
ZL
::
Util
;
using
namespace
ZL
::
Http
;
using
namespace
ZL
::
Http
;
using
namespace
ZL
::
Rtsp
;
using
namespace
ZL
::
Rtsp
;
using
namespace
ZL
::
Rtmp
;
using
namespace
ZL
::
Rtmp
;
using
namespace
ZL
::
Shell
;
using
namespace
ZL
::
Thread
;
using
namespace
ZL
::
Thread
;
using
namespace
ZL
::
Network
;
using
namespace
ZL
::
Network
;
using
namespace
ZL
::
DEV
;
using
namespace
ZL
::
DEV
;
...
@@ -49,6 +51,15 @@ int main(int argc,char *argv[]){
...
@@ -49,6 +51,15 @@ int main(int argc,char *argv[]){
map
<
string
,
PlayerProxy
::
Ptr
>
proxyMap
;
map
<
string
,
PlayerProxy
::
Ptr
>
proxyMap
;
int
i
=
0
;
int
i
=
0
;
for
(
auto
url
:
urlList
){
for
(
auto
url
:
urlList
){
//PlayerProxy构造函数前两个参数分别为应用名(app),流id(streamId)
//比如说应用为live,流id为0,那么直播地址为:
//http://127.0.0.1/live/0/hls.m3u8
//rtsp://127.0.0.1/live/0
//rtmp://127.0.0.1/live/0
//录像地址为:
//http://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
//rtsp://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
//rtmp://127.0.0.1/record/live/0/2017-04-11/11-09-38.mp4
PlayerProxy
::
Ptr
player
(
new
PlayerProxy
(
"live"
,
std
::
to_string
(
i
++
).
data
()));
PlayerProxy
::
Ptr
player
(
new
PlayerProxy
(
"live"
,
std
::
to_string
(
i
++
).
data
()));
player
->
play
(
url
);
player
->
play
(
url
);
proxyMap
.
emplace
(
string
(
url
),
player
);
proxyMap
.
emplace
(
string
(
url
),
player
);
...
@@ -67,23 +78,29 @@ int main(int argc,char *argv[]){
...
@@ -67,23 +78,29 @@ int main(int argc,char *argv[]){
TcpServer
<
RtspSession
>::
Ptr
rtspSrv
(
new
TcpServer
<
RtspSession
>
());
TcpServer
<
RtspSession
>::
Ptr
rtspSrv
(
new
TcpServer
<
RtspSession
>
());
TcpServer
<
RtmpSession
>::
Ptr
rtmpSrv
(
new
TcpServer
<
RtmpSession
>
());
TcpServer
<
RtmpSession
>::
Ptr
rtmpSrv
(
new
TcpServer
<
RtmpSession
>
());
TcpServer
<
HttpSession
>::
Ptr
httpSrv
(
new
TcpServer
<
HttpSession
>
());
TcpServer
<
HttpSession
>::
Ptr
httpSrv
(
new
TcpServer
<
HttpSession
>
());
TcpServer
<
ShellSession
>::
Ptr
shellSrv
(
new
TcpServer
<
ShellSession
>
());
rtspSrv
->
start
(
mINI
::
Instance
()[
Config
::
Rtsp
::
kPort
]);
rtspSrv
->
start
(
mINI
::
Instance
()[
Config
::
Rtsp
::
kPort
]);
rtmpSrv
->
start
(
mINI
::
Instance
()[
Config
::
Rtmp
::
kPort
]);
rtmpSrv
->
start
(
mINI
::
Instance
()[
Config
::
Rtmp
::
kPort
]);
httpSrv
->
start
(
mINI
::
Instance
()[
Config
::
Http
::
kPort
]);
httpSrv
->
start
(
mINI
::
Instance
()[
Config
::
Http
::
kPort
]);
//简单的telnet服务器,可用于服务器调试,但是不能使用23端口
//测试方法:telnet 127.0.0.1 8023
//输入用户名和密码登录(user:test,pwd:123456),输入help命令查看帮助
ShellSession
::
addUser
(
"test"
,
"123456"
);
shellSrv
->
start
(
8023
);
#ifdef ENABLE_OPENSSL
#ifdef ENABLE_OPENSSL
TcpServer
<
HttpsSession
>::
Ptr
httpsSrv
(
new
TcpServer
<
HttpsSession
>
());
TcpServer
<
HttpsSession
>::
Ptr
httpsSrv
(
new
TcpServer
<
HttpsSession
>
());
httpsSrv
->
start
(
mINI
::
Instance
()[
Config
::
Http
::
kSSLPort
]);
httpsSrv
->
start
(
mINI
::
Instance
()[
Config
::
Http
::
kSSLPort
]);
#endif //ENABLE_OPENSSL
#endif //ENABLE_OPENSSL
EventPoller
::
Instance
().
runLoop
();
EventPoller
::
Instance
().
runLoop
();
proxyMap
.
clear
();
rtspSrv
.
reset
();
rtspSrv
.
reset
();
rtmpSrv
.
reset
();
rtmpSrv
.
reset
();
httpSrv
.
reset
();
httpSrv
.
reset
();
shellSrv
.
reset
();
#ifdef ENABLE_OPENSSL
#ifdef ENABLE_OPENSSL
httpsSrv
.
reset
();
httpsSrv
.
reset
();
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论