📄 protocol.c
字号:
#include "stdafx.h"
#include "GprsServer.h"
#include "GprsServerDlg.h"
#include "protocol.h"
PACKAGE packData;
//****填充数据缓冲区数据***************************
void FillSendBufContent(void)
{
uchar data = 0;
packData.cmd_type = CLIENT_QUERY;
data += package.cmd_type;
packData.cmd = QUERY_DATA;
data += package.cmd;
packData.checksum = ~data;
}
/*
UINT _SendMsgThread(LPVOID lparam) //TCP发送信息线程
{
CMyQQDlg *pDlg=(CGprsServerDlg *)lparam;
if(pDlg->StopServer==true) return -1;
CSocket sockClient;
sockClient.Create();
CString ip,strError;
pDlg->m_YourIP.GetWindowText(ip);
// int conn=sockClient.Connect(ip, PORT+pDlg->m_client);
if(conn==0) ///////////////////////////////////
{
AfxMessageBox("_SendMsgThread Connect错误!" + pDlg->GetError(GetLastError()));
sockClient.ShutDown(2);
sockClient.Close();
AfxEndThread(1L);
return 0;
}
//首先发送标记M为信息,2
int end=0;
end = sockClient.Send("M",FLAG);
if(end == SOCKET_ERROR)
{
AfxMessageBox("_SendMsgThread Send错误!"+pDlg->GetError(GetLastError()));
return -1;
}
else if(end != 2)
{
AfxMessageBox("消息头错误");
return -1;
}
/* CString strMsg = pDlg->m_MsgSend;
end = sockClient.Send(strMsg,strMsg.GetLength());
if(end == SOCKET_ERROR)
{
AfxMessageBox("_SendMsgThread Send错误!"+pDlg->GetError(GetLastError()));
return -1;
}*/
/* CString strLocalName;
pDlg->GetLocalHostName(strLocalName);
CString strLocalIP;
pDlg->GetIpAddress(strLocalName,strLocalIP);
pDlg->AddMsgList(strLocalIP+"->"+strLocalName,strMsg);
int i=0;
sockClient.Close();
return 0;
}*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -