freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于tcp的網(wǎng)絡(luò)通信協(xié)議設(shè)計(jì)畢業(yè)論文(參考版)

2025-05-30 18:09本頁(yè)面
  

【正文】 if (!pSocketGet。itor++) { CClientSocket *pSocket = *itor。 for (itor = CClientSocket::()。InSertLog(pPacksenderID,_T(退出))。pack,sizeof(NET_PACK))。 lstrcpy(,pIDSocketGetUID())。pack,0,sizeof(NET_PACK))。 NET_PACK pack。 IDitor != Enditor。 Enditor。 Enditor = IDitor。 IDitor != CClientSocket::()。 } else { listCClientSocket*::iterator IDitor,Enditor。itor++) { CClientSocket *pPSocket = *itor。 for (itor = CClientSocket::()。 SetWindowText(strTitle)。 CString strTitle。// pSocketSetUID(pPacksenderID)。 } return 0。 case SHAKE: DealShake(pPack)。 case TRANSMIT: DealTransmit(pPack)。 case LOGOUT: DealLogOut(pPack)。 } switch (pPackfun) {case LOGIN: DealLogin(pPack,pSocket)。 pSocketSetUID(pPacksenderID)。 memset(pPack,0,sizeof(NET_PACK))。}(9)服務(wù)器端發(fā)送并處理LRESULT CDlgTCPSeverDlg::OnNetReceive(WPARAM wParam,LPARAM lParam){ CClientSocket *pSocket = (CClientSocket *)lParam。AfxGetApp()m_pMainWndPostMessage(WM_NET_RECEIVE,(WPARAM)pPack,(LPARAM)this)。memset(pPack,0,sizeof(NET_PACK))。pack,sizeof(NET_PACK))。 lstrcpy(,strUser)。 lstrcpy(,strUser)。 CString strUser。pack,0,sizeof(NET_PACK))。}void CDlgTCPClientDlg::OnBtnShake() { // TODO: Add your control notification handler code here NET_PACK pack。 (1)。strContent += 。 CTime time = CTime::GetCurrentTime()。pack,sizeof(NET_PACK))。lstrcpy(,strUser)。strContent = strUser。(strUser)。 =lstrlen(strContent)。pack,0,sizeof(NET_PACK))。 } NET_PACK pack。if (()) { AfxMessageBox(_T(聊天內(nèi)容不能為空!))。}(6)客戶端發(fā)送消息,void CDlgTCPClientDlg::OnBtnSend() { // TODO: Add your control notification handler code here CString strContent,strUser。Accept(*pSocket)。 return。 } (4)對(duì)于客戶端,實(shí)行連接,例如: if (!(m_strIP,m_nPort)) { AfxMessageBox(_T(CSocket連接失敗!))。 if (!()) { AfxMessageBox(_T(CSocket創(chuàng)建失?。?)。 }(3)客戶端創(chuàng)建Socket代碼片段:class CClientSocket : public CSocket{......}。 ()。 return。} 協(xié)議工作設(shè)計(jì)(1)服務(wù)器端類設(shè)計(jì)(2)客戶端類設(shè)計(jì):(1)服務(wù)器端創(chuàng)建Socket代碼片段: class CListenSocket : public CSocket{.......}。}CString amp。 CSocket::OnReceive(nErrorCode)。Receive(pPack,sizeof(NET_PACK))。CClientSocket::CClientSocket(){}CClientSocket::~CClientSocket(){}// Do not edit the following lines, which are needed by ClassWizard.if 0BEGIN_MESSAGE_MAP(CClientSocket, CSocket) //{{AFX_MSG_MAP(CClientSocket) //}}AFX_MSG_MAPEND_MESSAGE_MAP()endif // 0/////////////////////////////////////////////////////////////////////////////// CClientSocket member functionsvoid CClientSocket::OnReceive(int nErrorCode) { // TODO: Add your specialized code here and/or call the base class NET_PACK *pPack = new NET_PACK。(2):include include include ifdef _DEBUGdefine new DEBUG_NEWundef THIS_FILEstatic char THIS_FILE[] = __FILE__。 //}}AFX_VIRTUAL // Generated message map functions //{{AFX_MSG(CClientSocket) // NOTE the ClassWizard will add and remove member functions here. //}}AFX_MSG// Implementationprotected: CString m_strUID。 static listCClientSocket* m_listClient。 GetUID()。 virtual ~CClientSocket()。(1):include include listusing namespace std。 }(一臺(tái)服務(wù)器與多個(gè)客戶端通信)在服務(wù)器端添加了一個(gè)專門用來處理客戶端的連接的類CientSocket,其包含的成員如圖; 該類擁有靜態(tài)成員m_listClient:定義為static listCClientSocket* m_listClient。}f. 用戶登錄,對(duì)應(yīng)協(xié)議“NET_PACK”的前4byte,功能選擇“fun”的“ERR”。 (1)。 strContent += pPackConnect。 CTime time = CTime::GetCurrentTime()。 strContent = pPacksenderID。}e. 用戶登錄,對(duì)應(yīng)協(xié)議“NET_PACK”的前4byte,功能選擇“fun”的“TRANSMIT”。 } SetWindowPos(amp。CWnd::wndTopMost,(),(),SWP_NOSIZE)。 Sleep(30)。 SetWindowPos(amp。CWnd::wndTopMost, 3,(),(),SWP_NOSIZE)。i 5。 GetWindowRect(rc)。}d. 用戶登錄,對(duì)應(yīng)協(xié)議“NET_PACK”的前4byte,功能選擇“fun”的“SHAKE”。 SetWindowText(_T(客戶端))。 (FALSE)。 (FALSE)。 ()。void CDlgTCPClientDlg::DealSvrStop(const char *Connect){ AfxMessageBox(Connect)。 if (!(SenderID)) { ()。 } } CString strUName。if (!(strRCVName)) { (_T())。CString strRCVName。i++) { CString str = (i,1)。void CDlgTCPClientDlg::DealLogOut(char *SenderID){ for (int i = 0。 (n,1,lpSenderID)。void CDlgTCPClientDlg::DealLogIn(LPTSTR lpSenderID){ int n = ()。 } return 0。 case ERR: DealError(pPackConnect)。 case SHAKE: DealShake()。 case TRANSMIT: DealTransmit(pPack)。 case SVRSTOP: DealSvrStop(pPackConnect)。 case LOGOUT: DealLogOut(pPacksenderID)。 switch (pPackfun) { case LOGIN: DealLogIn(pPacksenderID)。}(6)消息接收代碼。}(5)關(guān)閉客戶端對(duì)話框代碼:void CDlgTCPClientDlg::OnClose() { // TODO: Add your message handler code here and/or call defaultOnBtnLogout()。(TRUE)。(strName)。CString strName。(FALSE)。(FALSE)。(1,_T(在線好友),LVCFMT_LEFT,133)。(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_FLATSB)。 (strContent)。strContent += _T(\r\n)。 strContent += (_T(%H:%M:%S\r\n * ))。// strContent += _T(\t\t)。 (amp。(strUser)。lstrcpy(,strUser)。lstrcpy(,strContent)。 = TRANSMIT。memset(amp。 return。(strContent)。pack,sizeof(NET_PACK))。 lstrcpy(,strUser)。 lstrcpy(,strUser)。 CString strUser。pack,0,sizeof(NET_PACK))。}(3)“抖動(dòng)”控件代碼設(shè)計(jì):void CDlgTCPClientDlg::OnBtnShake() { // TODO: Add your control notification handler code here NET_PACK pack。pack,sizeof(NET_PACK))。 lstrcpy(,str)。 CString str。pack,0,sizeof(NET_PACK))。// NET_PACK pack。(FALSE)。(TRUE)。(_T())。}(2)“退出”控件代碼設(shè)計(jì):void CDlgTCPClientDlg::OnBtnLogout() { // TODO: Add your control notification handler code here MessageBox(確定退出!)。(amp。 (str)。 = LOGIN。 memset(amp。 SetWindowText(strTitle)。 (strRet)。(FALSE)。 } (FALSE)。 ()。 return。return。 (usrName)。 (n,3,strEvent)。 strTemp = (_T(%y/%m/%d %H:%M:%S))。 (n,1,strUser)。 (_T(%d
點(diǎn)擊復(fù)制文檔內(nèi)容
規(guī)章制度相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1