d113.bmp.txt

来自「Visual C++通信编程工程实例精解(附盘)」· 文本 代码 · 共 42 行

TXT
42
字号
l
else
{
msg->Senalize(*m_aS essionOut);
m_aSessionOut->Flush0;
retum TRUE;
//对方关闭了连接
m_bClose=true;
CloseSocket0;
m_dlg->CloseSessionSocket0;
return FALSE;
7)添加CChatClient类关闭连接函数CloseSocket0。
       void CChatClient::CloseSocket()
         {
if(m_aSessionln)
                   {
                     delete m_aSessionln;
m_aSessionIn=NULL;
                   }
if(m_aSessionOut)
                   {
                     delete m_aSessionOut;
m_aSessionOut=NULL;
if(m_sfSocketFile)
                   {      .
                       delete m_aSessionOut;
m_sfSocketFile=NULL;
                 }
 Close();
m_blnit=false;
m_bClose=true;
          }
8)添加 CChatClient类获取主机名函数 GetLocalHostName O。
int CChatClient::GetLocaIHostName(CString &sHostName)
{
        char szHostNamel256J;
        int nRetCode;
                              nRetCode=gethostname(szHostN ame,sizeof(szHostName》;
               if(nRetCode !:=:0)
          {
//3

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?