Common.h
资源名称:GGBT.rar [点击查看]
上传用户:lds876
上传日期:2013-05-25
资源大小:567k
文件大小:1k
源码类别:
P2P编程
开发平台:
Visual C++
- // Common.h: interface for the CCommon class.
- //
- //////////////////////////////////////////////////////////////////////
- #if !defined(AFX_COMMON_H__DA53EFA0_B9A5_4CEE_9F0D_8537E4EB983B__INCLUDED_)
- #define AFX_COMMON_H__DA53EFA0_B9A5_4CEE_9F0D_8537E4EB983B__INCLUDED_
- #if _MSC_VER > 1000
- #pragma once
- #endif // _MSC_VER > 1000
- #include "memstream.h"
- string formatDir(string strDir);
- string ltostring(long lVal);
- string WSAShowError();
- bool IsEventSet(HANDLE hEvent);
- bool DeleteDiretory(CString strOld);
- class CWinsockInit
- {
- public:
- ~CWinsockInit()
- {
- WSACleanup();
- }
- CWinsockInit()
- {
- // init socket.
- WORD wVersionRequested;
- WSADATA wsaData;
- wVersionRequested = MAKEWORD( 2, 2 );
- int err = WSAStartup( wVersionRequested, &wsaData );
- if ( err != 0 )
- {return;}
- }
- };
- class CAddrPort
- {
- public:
- CAddrPort(long lAddr, short sPort)
- {
- m_lAddr = lAddr;
- m_sPort = sPort;
- }
- long m_lAddr;
- short m_sPort;
- };
- #endif // !defined(AFX_COMMON_H__DA53EFA0_B9A5_4CEE_9F0D_8537E4EB983B__INCLUDED_)