编译没错,但是向客户端发送消息出错了。
CMofServerDlg 为主对话框,SOCKET是在这里开启的,在CMofServerDlg.cpp里面,能正常的发送与接受消息。而CMofServerGg里面,无法向客户端发送消息。AfxMessageBox("发送出错,请检查网络!");
客户端是连上了的。void CMofServerGg::OnOK() 
{
// 用户按钮消息
CMofServerDlg *pThis=(CMofServerDlg *)AfxGetApp();
CWnd   *pEdit=(CWnd*)GetDlgItem(IDC_RICHEDIT_GG);
    pEdit->GetWindowText(Adinfo);
if(Adinfo == "")
{
MessageBox("请输入要发布的广告信息!","提示!",MB_ICONINFORMATION);
m_RichEditGG.SetFocus();
return;
}
strncpy(pThis->pack.SYSTEMINFO,Adinfo,100);
AfxMessageBox(pThis->pack.SYSTEMINFO);
if (send(pThis->Client,(char *)&pThis->pack,sizeof(pThis->pack),0)== SOCKET_ERROR)
{
    AfxMessageBox("发送出错,请检查网络!");
}
else
{
AfxMessageBox("信息发送成功!");
}
}