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

正文內(nèi)容

基于visualc的一個簡單的網(wǎng)絡(luò)電話系統(tǒng)畢業(yè)論文(編輯修改稿)

2025-07-24 19:26 本頁面
 

【文章內(nèi)容簡介】 ementation fileinclude include include include ifdef _DEBUGdefine new DEBUG_NEWundef THIS_FILEstatic char THIS_FILE[] = __FILE__。endifdefine WM_NC 1001extern CSocketServer Socket_Server。extern CSocketServer Socket_Listen。extern CNetPhoneDlg *pDlg。extern BOOL bBtnConnectDown。extern BOOL bServerState。extern BOOL bClientState。extern BOOL bDisconnectState。extern BOOL bMiniState。extern CString sRemoteIP。extern CString sAck。extern char cAck[15]。// CSocketServerCSocketServer::CSocketServer(){}CSocketServer::~CSocketServer(){ Close()。}// Do not edit the following lines, which are needed by ClassWizard.if 0BEGIN_MESSAGE_MAP(CSocketServer, CAsyncSocket) //{{AFX_MSG_MAP(CSocketServer) //}}AFX_MSG_MAPEND_MESSAGE_MAP()endif // 0// FD_ACCEPT網(wǎng)絡(luò)事件處理函數(shù),收到連接請求時發(fā)生void CSocketServer::OnAccept(int nErrorCode) { // Socket_Server套接字接受連接請求 Accept(Socket_Server)。 // 錯誤信息處理 if (0 != nErrorCode) { switch( nErrorCode) //nErrorCode 為錯誤碼 { case WSANOTINITIALISED: AfxMessageBox(A successful AfxSocketInit must occur before using this API.\n)。 break。 case WSAENETDOWN: AfxMessageBox(The Windows Sockets implementation detected that the network subsystem failed.\n)。 break。 case WSAEFAULT: AfxMessageBox(The lpSockAddrLen argument is too small.\n)。 break。 case WSAEINPROGRESS: AfxMessageBox(A blocking Windows Sockets call is in progress.\n)。 break。 case WSAEINVAL: AfxMessageBox(Listen was not invoked prior to accept.\n)。 break。 case WSAEMFILE: AfxMessageBox(The queue is empty upon entry to accept and there are no descriptors available.\n)。 break。 case WSAENOBUFS: AfxMessageBox(No buffer space is available.\n)。 break。 case WSAENOTSOCK: AfxMessageBox(The descriptor is not a socket.\n)。 break。 case WSAEOPNOTSUPP: AfxMessageBox(The referenced socket is not a type that supports connectionoriented service.\n)。 break。 case WSAEWOULDBLOCK: AfxMessageBox(The socket is marked as nonblocking and no connections are present to be accepted. \n)。 break。 default: TCHAR szError[256]。 wsprintf(szError, OnAccept error: %d, nErrorCode)。 AfxMessageBox(szError,MB_ICONINFORMATION | MB_OK,NULL)。 break。 } } // 若是被呼叫端,“連接”按鈕未被按下,即bBtnConnectDown=FALSE // 收到連接請求時,播放鈴聲并顯示通知信息通知被呼叫端用戶 if(bBtnConnectDown==FALSE) { UINT RemotePort=5000。 // 得到呼叫端IP地址及端口 (sRemoteIP,RemotePort)。 // 播放鈴聲 PlaySound(,NULL,SND_SYNC)。 // 設(shè)置各個按鈕狀態(tài) pDlgGetDlgItem(IDC_BUTTON_COMMUNICATE)EnableWindow(TRUE) 。 pDlgGetDlgItem(IDC_BUTTON_DISCONNECT)EnableWindow(TRUE) 。 pDlgSetDlgItemText(IDC_BUTTON_DISCONNECT,拒 接)。 // 在對話框IDC_STATIC_INFORMATION控件中顯示通知信息 ::SetDlgItemText(pDlgm_hWnd,IDC_STATIC_INFORMATION,sRemoteIP+有電話呼叫您)。 } // 程序是否處于最小化狀態(tài),是的話,最大化程序窗口,通知用戶有呼叫進(jìn)入 if(bMiniState==TRUE) { ::SendMessage(pDlgm_hWnd,WM_NC,0,WM_LBUTTONDBLCLK)。 } CAsyncSocket::OnAccept(nErrorCode)。}// FD_READ網(wǎng)絡(luò)事件處理函數(shù),有數(shù)據(jù)到達(dá)時發(fā)生void CSocketServer::OnReceive(int nErrorCode) { // 錯誤信息處理 if (0 != nErrorCode) { switch( nErrorCode) //nErrorCode 為錯誤碼 { case WSANOTINITIALISED: AfxMessageBox(A successful AfxSocketInit must occur before using this API.\n)。 break。 case WSAENETDOWN: AfxMessageBox(The Windows Sockets implementation detected that the network subsystem failed.\n)。 break。 case WSAENOTCONN: AfxMessageBox(The socket is not connected.\n)。 break。 case WSAEINPROGRESS: AfxMessageBox(A blocking Windows Sockets operation is in progress.\n)。 break。 case WSAENOTSOCK: AfxMessageBox(The descriptor is not a socket.\n)。 break。 case WSAEOPNOTSUPP: AfxMessageBox(MSG_OOB was specified, but the socket is not of type SOCK_STREAM.\n)。 break。 case WSAESHUTDOWN: AfxMessageBox(The socket has been shut down. \n)。 break。 case WSAEWOULDBLOCK: AfxMessageBox(The socket is marked as nonblocking and the Receive operation would block.\n)。 break。 case WSAEMSGSIZE: AfxMessageBox(The datagram was too large to fit into the specified buffer and was truncated.\n)。 break。 case WSAEINVAL: AfxMessageBox(The socket has not been bound with Bind.\n)。 break。 case WSAECONNABORTED: AfxMessageBox(The virtual circuit was aborted due to timeout or other failure.\n)。 break。 case WSAECONNRESET: AfxMessageBox(The virtual circuit was reset by the remote side. \n)。 break。 default: TCHAR szError[256]。 wsprintf(szError, OnReceive error: %d, nErrorCode)。 AfxMessageBox(szError)。 break。 } } // 若是呼叫端,則“連接”按鈕被按下,自動進(jìn)入客戶端狀態(tài), // 即bBtnConnectDown=TRUE且bClientState=TRUE // 接收到來自被呼叫端的應(yīng)答信息,判斷是否電話被接聽 if(bBtnConnectDown==TRUEamp。amp。bClientState==TRUEamp。amp。bServerState==FALSE) { // 接收15個字節(jié)信息 Receive(cAck,15)。 (%s,cAck)。 // 如果接收到被呼叫端發(fā)送的15個字節(jié)信息為“ABCDEFGHIJKLMNO”,表示電話被接聽 if(sAck==ABCDEFGHIJKLMNO) { bServerState=TRUE。 ::SetDlgItemText(pDlgm_hWnd,IDC_STATIC_INFORMATION,恭喜恭喜,電話被接聽)。 ::SendMessage(pDlgm_hWnd, WM_COMMAND, IDC_BUTTON_COMMUNICATE, 0)。 } else { ::SetDlgItemText(pDlgm_hWnd,IDC_STATIC_INFORMATION,不好意思,對方拒接電話)。 bServe
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)教案相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1