You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.2 KiB
C++

#ifndef _M_UDP_
#define _M_UDP_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// MulticastSocket.h : header file
typedef void(CALLBACK*MulticastCALLBACK)(unsigned char* buffer, const DWORD size,LPVOID lp);
#include <afxsock.h>
class CMUDP : public CAsyncSocket
{
public:
CMUDP();
virtual ~CMUDP();
public:
BOOL InitGroup( CString, UINT, UINT, BOOL );
BOOL LeaveGroup();
BOOL SendToY( const void *, int );
void SetReadCallBack(MulticastCALLBACK fun, LPVOID lp);
public:
virtual void OnReceive(int nErrorCode);
private:
unsigned char m_strBuffer[32000]; // Receiving buffer for the packet that has arrived
SOCKADDR_IN m_saHostGroup; // SOCKADDR structure to hold IP/Port of the Host group to send data to it
ip_mreq m_mrMReq; // Contains IP and interface of the host group
UINT m_nSendersPort; // Holds Port No. of the socket from which last packet was received
CString m_strSendersIP; // Hold IP of the socket from which the last packet was received
MulticastCALLBACK m_fun;
LPVOID m_param;
};
#endif // !defined(AFX_MULTICASTSOCKET_H__269E2C7F_2037_11D3_8EF3_0000C0FD25F8__INCLUDED_)