Multicast.h
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:1k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // Multicast.h: interface for the CMulticast class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_MULTICAST_H__F513328F_B1AE_4FBB_BA82_777E938EB58D__INCLUDED_)
- #define AFX_MULTICAST_H__F513328F_B1AE_4FBB_BA82_777E938EB58D__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "winsock2.h"
- #include "Ws2tcpip.h"
- #include "....公共类Buffer.h"
- #define MAX_BUFFER_SIZE 50000
- class CMulticast
- {
- public:
- CMulticast();
- virtual ~CMulticast();
- //加入组播组
- bool AddMemberShip( const char * ip , const int port );
- //移出组播组
- void DropMemberShip( void );
- //是否连接
- bool IsConnected( void ){ return this->m_sock != INVALID_SOCKET; }
- //发送组播数据
- bool SendTo( CBuffer & buffer );
- //接收组播数据
- bool ReceiveFrom( CBuffer & buffer );
- void SetData( int user_data ){ this->user_data = user_data; }
- int GetData( void ){ return this->user_data; }
- private:
- static int InitWSAStatup;
- SOCKET m_sock;
- struct sockaddr_in addr;
- struct ip_mreq command;
- int user_data;
- char recvBuffer[ MAX_BUFFER_SIZE ];
- };
- #endif // !defined(AFX_MULTICAST_H__F513328F_B1AE_4FBB_BA82_777E938EB58D__INCLUDED_)
English
