Commit d9dea060 by xiongziliang

返回端口号

parent fe4da29f
......@@ -79,38 +79,38 @@ API_EXPORT void API_CALL setGlobalOptionString(const char *key,const char *val){
}
mINI::Instance()[key] = val;
}
API_EXPORT int API_CALL initHttpServer(unsigned short port){
API_EXPORT unsigned short API_CALL initHttpServer(unsigned short port){
s_pHttpSrv.reset(new TcpServer());
try {
s_pHttpSrv->start<HttpSession>(port);
return 0;
return s_pHttpSrv->getPort();
} catch (std::exception &ex) {
s_pHttpSrv.reset();
WarnL << ex.what();
return -1;
return 0;
}
}
API_EXPORT int API_CALL initRtspServer(unsigned short port) {
API_EXPORT unsigned short API_CALL initRtspServer(unsigned short port) {
s_pRtspSrv.reset(new TcpServer());
try {
s_pRtspSrv->start<RtspSession>(port);
return 0;
return s_pRtspSrv->getPort();
} catch (std::exception &ex) {
s_pRtspSrv.reset();
WarnL << ex.what();
return -1;
return 0;
}
}
API_EXPORT int API_CALL initRtmpServer(unsigned short port) {
API_EXPORT unsigned short API_CALL initRtmpServer(unsigned short port) {
s_pRtmpSrv.reset(new TcpServer());
try {
s_pRtmpSrv->start<RtmpSession>(port);
return 0;
return s_pRtmpSrv->getPort();
} catch (std::exception &ex) {
s_pRtmpSrv.reset();
WarnL << ex.what();
return -1;
return 0;
}
}
......
......@@ -56,24 +56,24 @@ API_EXPORT void API_CALL setGlobalOptionString(const char *key,const char *val);
/*
* 描述:创建Http服务器
* 参数:port:htt监听端口,推荐80
* 返回值:0:成功;-1:失败
* 参数:port:htt监听端口,推荐80,传入0则随机分配
* 返回值:0:失败,非0:端口号
*/
API_EXPORT int API_CALL initHttpServer(unsigned short port);
API_EXPORT unsigned short API_CALL initHttpServer(unsigned short port);
/*
* 描述:创建RTSP服务器
* 参数:port:rtsp监听端口,推荐554
* 返回值:0:成功;-1:失败
* 参数:port:rtsp监听端口,推荐554,传入0则随机分配
* 返回值:0:失败,非0:端口号
*/
API_EXPORT int API_CALL initRtspServer(unsigned short port);
API_EXPORT unsigned short API_CALL initRtspServer(unsigned short port);
/*
* 描述:创建RTMP服务器
* 参数:port:rtmp监听端口,推荐1935
* 返回值:0:成功;-1:失败
* 参数:port:rtmp监听端口,推荐1935,传入0则随机分配
* 返回值:0:失败,非0:端口号
*/
API_EXPORT int API_CALL initRtmpServer(unsigned short port);
API_EXPORT unsigned short API_CALL initRtmpServer(unsigned short port);
/////////////////////////日志////////////////////////////////
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论