⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 localserver.h

📁 mysee网络直播源代码Mysee Lite是Mysee独立研发的网络视频流媒体播放系统。在应有了P2P技术和一系列先进流媒体技术之后
💻 H
字号:
/*
 *  Openmysee
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
#ifndef __LOCALSERVER_H_
#define __LOCALSERVER_H_

#include "ChannelMgr.h"
#include "ChaosUI.h"
#include "MsgMgr.h"

#define LOCALSERVERPORT 11668
#define MAX_PENDING_SOCKET 255

#define USE_NAT 0
// { Declaration of CLocalServer

//local server将处理WM_SENDTOLOCALSERVER消息 WM是消息case, LM待定
#define CASE_THREAD_EXIT    4

class CLocalServer
{
public:
	static CLocalServer *CreateInstance();
	static void DeleteInstance();

private:
    long    m_ThreadRef;
public:
        //      对每一个使用了在主线程建立的窗口的线程, 都应该调用该函数进行注册,并在线程退出时发送WM_SENDTOLOCALSERVER消息,
        //      case为CASE_THREAD_EXIT,以便系统能对窗口资源进行回收而不至于死锁
    void    AddWndThreadRef()
    {
        m_ThreadRef++;
    }
    void    FireExit();
	void    HandleLocalSrvNotify(WPARAM wparam, LPARAM lparam);
	BOOL Run();
	void Stop();
	
	BOOL AddChannel(SOCKET sock);
	void DeleteChannel(CHANNELID ChannelID);

	UINT GetChannelNum();
	void GetChannelIDArray(CHANNELID *pChannelIDArray);
	void GetChannelMgrArray(CChannelMgr* pChannelMgrArray[]);
	CChannelMgr *GetChannelMgr(CHANNELID ChannelID);
	void UpdateLayer1Notify(WPARAM wparam, LPARAM lparam);
//	CChannelMgr *GetChannelMgr(HWND hWnd);
	CMsgMgr*	GetMsgMgr();
	void	UpdateNoChannelMsg();
//	friend class CChaosUI;

protected:
	CLocalServer();
	CLocalServer(const CLocalServer&);
	virtual ~CLocalServer();
	CLocalServer &operator=(const CLocalServer&);
#if USE_NAT
	BOOL InitNatProxy();
	BOOL ExitNatProxy();
#endif

	BOOL InitNetWork();
	static DWORD WINAPI _ConnectProc(LPVOID lpParam);
	HANDLE m_hConncetThread;
	bool	volatile	m_bConnStop;

private:
	typedef std::map<CHANNELID, CChannelMgr *> ChannelMap;

	static CLocalServer *m_pLocalServer;

	CCritSec m_MapCritSec;
	ChannelMap m_ChannelMap;
	UINT m_uChlCounter;
//	UINT m_uMsgNum;
	SOCKET m_ListenSocket;
	DWORD m_dwConnectThreadID;

	CMsgMgr m_MsgMgr;
	MSGID m_ErrMsgID;
};
// Declaration of CLocalServer }

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -