InetAccept Example for C++ 5.0 and later

void CRasterInetSink::OnInetAccept(short iServer)
{
   short hComputer;
   short nRet;
   TCHAR szHostName[80];
   BSTR bstrText;
   CString strText;
   CString cs;

   nRet = m_pDlg->m_pRasterInet->InetAcceptConnect(m_pDlg->m_hServer);
   hComputer = m_pDlg->m_pRasterInet->GetInetConnectedComputer();

   if(nRet != 0)
   {
      AfxMessageBox(TEXT("Error accepting connection!"));
      return;
   }

   m_pDlg->m_pRasterInet->InetGetHostName(hComputer, HOST_NAME_DESCRP);
   bstrText = m_pDlg->m_pRasterInet->GetInetHostName();

   //add to our list
   m_pDlg->m_pRasterInet->put_SendList(m_pDlg->m_pRasterInet->SendListNum, hComputer);
   strText = bstrText;
   lstrcpy(szHostName, (LPCTSTR)strText);
   ::SysFreeString(bstrText);
   cs.Format(TEXT("Connection accepted from:%s"), strText);
   AfxMessageBox(cs);
}