⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listensock.cpp

📁 一个完整的数字硬盘录像机系统软件
💻 CPP
字号:
#include "stdafx.h"
#include "GtMpeg.h"
#include "GtMpegWnd.h"
#include "ListenSock.h"
IMPLEMENT_DYNAMIC(CListenSocket, CSocket)
//////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////
CListenSocket::CListenSocket()
{
}
/////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////
void CListenSocket::OnAccept(int nErrorCode)
{
	CSocket::OnAccept(nErrorCode);
	CGtMpegWnd* pWnd=(CGtMpegWnd*)theApp.m_pMainWnd;
	pWnd->ProcessPendingAccept();
}
//////////////////////////////////
//
/////////////////////////////////
CListenSocket::~CListenSocket()
{
}
/////////////////////////////////////////////////
//
/////////////////////////////////////////////////
#ifdef _DEBUG
void CListenSocket::AssertValid() const
{
	CSocket::AssertValid();
}
/////////////////////////////////////////////////
//
/////////////////////////////////////////////////
void CListenSocket::Dump(CDumpContext& dc) const
{
	CSocket::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////
//
/////////////////////////////////////////////
CString  CListenSocket::GetThisIP()
{
      WORD wversionrequested;
      WSADATA  wsadata;
      char name[255];
      CString ip;
      hostent  *hostinfo;
      wversionrequested = MAKEWORD( 2, 0 );
      if ( WSAStartup( wversionrequested, &wsadata ) == 0 )
      {

            if( gethostname ( name, sizeof(name)) == 0)
            {
                  if((hostinfo = gethostbyname(name)) != NULL)
                  {
                        ip = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
                  }
            }
            WSACleanup( );
      } 

 return ip;
}	

⌨️ 快捷键说明

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