1、多端口介绍
mediasoup中的多端口,指服务端对每个客户端都会开辟新的端口来监听,这样就会导致服务端同时暴露成百上千个端口,
实际生产环境肯定是不行的。
2、srs4.0 单端口连接管理介绍
srs中通过SrsRtcConnection来代表一个连接。注意这个SrsRtcConnection 并不代表一个发布者订阅者。
具体见:
// The RTC server instance, listen UDP port, handle UDP packet, manage RTC connections.
class SrsRtcServer : virtual public ISrsUdpMuxHandler, virtual public ISrsHourGlass
{
private:SrsHourGlass* timer;std::vector<SrsUdpMuxListener*> listeners;ISrsRtcServerHandler* handler;ISrsRtcServerHijacker* hijacker;
private:// TODO: FIXME: Rename it.std::map<std::string, SrsRtcConnection*> map_username_session; // key: username(local_ufrag + ":" + remote_ufrag)// TODO: FIXME: Rename it.std::map<std::string, SrsRtcConnection*> map_id_session; // key: peerip(ip + ":" + port)// The zombie sessions, we will free them