返回端口号

This commit is contained in:
xiongziliang 2018-02-28 10:58:36 +08:00
parent fe4da29fb1
commit d9dea060d3
2 changed files with 18 additions and 18 deletions

View File

@ -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;
}
}

View File

@ -56,24 +56,24 @@ API_EXPORT void API_CALL setGlobalOptionString(const char *key,const char *val);
/*
* :Http服务器
* :port:htt监听端口80
* :0:;-1:
* :port:htt监听端口800
* :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监听端口5540
* :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监听端口19350
* :0:,0:
*/
API_EXPORT int API_CALL initRtmpServer(unsigned short port);
API_EXPORT unsigned short API_CALL initRtmpServer(unsigned short port);
/////////////////////////日志////////////////////////////////