如题,最好给个代码例子,谢谢

解决方案 »

  1.   

    继承CAsyncSocket,并重写相应的函数
    如在OnClose中处理CLOSE事件等
      

  2.   

    m_pListSocket   =   new   CAsyncSocket(); 
    m_pListSocket-> Create( 端口,地址);                   // 创建m_pListSocket->Listen();                            // 开始监听 m_pListSocket::OnAccept( )                       // 有客户端请求连接时响应{m_pSocket   =   new   CAsyncSocket(); 
    m_pListSocket-> Accept(m_pSocket);       // 建立通信,成功后m_pSocket就用于发送和接受. // m_pSocket 就相当于连接的那个客户端了} m_pSocket::OnRecive( int nErrorCode){         if( nErrorCode == 0){         Recevie();                            // 接受客户端发送来的信息}         CAsyncSocket::OnRecive( nErrorCode)} m_pSocket::OnSend(){         Send();                        // 发送信息,该事件触发条件见下节} m_pListSocket->Close(); delete m_pListSocket;delete m_pSocket;
      

  3.   

    ilysony,你的代码我完全没看明白,不知道到底是变量调用了函数,还是函数调用了函数。