case 'D':wsprintf(msg,"D: Client form %s
detached\n",inet_ntoa(saClnt.sin_addr));
pView->m_data[pView->count++]=msg;
pView->flag=TRUE;本文来自辣,文~论^文·网原文请找腾讯752018766
pView->InvalidateRect(NULL);
pView->Isconnect=FALSE;
sendto(pView->m_sock,msg,1024,0,
(PSOCKADDR)&saClnt,saClntLen);
break;
case 'R':
saClntLen=sizeof(saClnt);
pView->m_data[pView->count++]=msg;
pView->flag=TRUE;
pView->InvalidateRect(NULL);
break;论文网http://www.751com.cn/
default:
break;
}
}
}
return(0);
}
6.在程序菜单项中添加"本机IP地址":
void CServerView::OnIp()
{
int WSAReturn;
WSAReturn=WSAStartup( 0x0101, &WSAData );
if( WSAReturn == 0 ){
gethostname( Hostname, 260 );
struct hostent *pHostEnt;
pHostEnt = gethostbyname( Hostname);
if( pHostEnt != NULL ){
wsprintf( Hostaddress, "%d.%d.%d.%d",
( pHostEnt->h_addr_list[0][0] & 0x00ff ),
( pHostEnt->h_addr_list[0][1] & 0x00ff ),
( pHostEnt->h_addr_list[0][2] & 0x00ff ),
( pHostEnt->h_addr_list[0][3] & 0x00ff ) );
CString out;
out.Format(Hostaddress);
AfxMessageBox(out);
}本文来自辣,文~论^文·网原文请找腾讯752018766
}
}
7.在程序菜单中添加"发送消息":
void CServerView::OnSendmessage()
{
// TODO: Add your command handler code here
char msg[2000];
Csend Sendmessage;
if(Sendmessage.DoModal()
上一页 [1] [2] [3] [4] [5] [6] 下一页