C++远程监控系统发送端-发送组播数据向指定地址发送数据

#include "stdafx.h"
#include "play.h"
#include "playDoc.h"
#include "playView.h"
#include "MainFrm.h"
#include "av8api.h"
#include "Define.h"
#include "Dos.h"
#include "direct.h"
#include "Afxmt.h"
#include "Windowsx.h"
#include "StopModeDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define BLOCKNUM 50
#define BLOCKLEN 32768 //32k
#define FILE_CLOSE(x)  if(x) { mmioClose(x, NULL);x=NULL;}
#define RELEASE_AV8BUFFER  if(g_pBuffer) {g_pBuffer->Stop();delete g_pBuffer;g_pBuffer = NULL;}
#define RELEASE_CVIDEOPLAY if(pVideoPlay){pVideoPlay->StopPlay();delete pVideoPlay;pVideoPlay=NULL;}
 
extern CMenu PopMenu;
BOOL m_Capture=FALSE;  //是否采集
CAV8Buffer *g_pBuffer = NULL;
HMMIO hmmioOutput;      //采集文件的句斌
HMMIO hmmioSendOutput;      //发送时保存文件的句斌
CString CapFileName;  //采集文件名
BOOL m_FileSend=FALSE;   //是否在发送文件数据

CEvent g_eventFileStopSend;  //停止发送文件标志,自动设置
CEvent g_eventRealSend(FALSE,TRUE,NULL,NULL);   //开始实时发送标志,手工设置
CEvent g_eventClearup;   //完成清除工作,可以Destory窗口标志
HWND hWnd ;//发送数窗口的句斌
float  m_size=0.00;     //采集数据大小
CString SendFilePath="";
#define WM_CAPTURE_STOP WM_USER+1000    //采集大小到,停止采集


//发送组播数据
DWORD SendData(LPWSABUF stWSABuf)
{
    CString msg;
    DWORD cbRet;
    cbRet = 0;

    CPlayApp* pApp=(CPlayApp*)AfxGetApp();
    //向指定地址发送数据
    int status = WSASendTo (MultiSock,   /* socket */
          stWSABuf,                        /* output buffer structure */
          1,                       /* buffer count */
          &cbRet,                  /* number of bytes sent */
          0,                    /* flags */
          (struct sockaddr FAR *)&DestAddr,/* destination address */
          sizeof(DestAddr), /* size of addr structure */
          NULL,                       /* overlapped structure */
          NULL);                   /* overlapped callback function */

    if (status == SOCKET_ERROR)
    {
          AfxMessageBox("WSASendTo() Error");
          return -1;
    }

    return cbRet;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

D20187

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值