NetAddress.h
上传用户:maryhy001
上传日期:2007-05-02
资源大小:2317k
文件大小:1k
- //File Name : NetAddress.h.
- //Standard Net Address Class header file that writen by Devia.
- //This code is free all, you can distribute it.
- //Author : Devia Li(devia@sina.com)
- //DateTime : 2004-04-04
- #ifndef _NETADDRESS_H
- #define _NETADDRESS_H
- class NETLIBDLLEXPORT CXNetAddress
- {
- public:
- CXNetAddress();
- CXNetAddress(CXNetAddress &);
- CXNetAddress(const SOCKADDR_IN sain);
- CXNetAddress(const uint unport);
- CXNetAddress(const uint unport, string &strIpAddress);
- CXNetAddress(const uint unport, const char *pszIpAddress);
- ~CXNetAddress();
- //initialize the ip address.
- void SetAddress(const SOCKADDR_IN sain);
- void SetAddress(const uint unport);
- void SetAddress(const uint unport, const char *pszIpAddress);
- //get the net address infos.
- SOCKADDR_IN GetSocketIn() const;
- const uint GetPortofAddr();
- const char *GetIpofAddr();
- //clone the CXNetAddress object.
- CXNetAddress *Clone();
- //overrides the tokens.
- CXNetAddress &operator=(const CXNetAddress &);
- operator SOCKADDR_IN();
- //get the local host name and ip address.
- static string GetLocalHostName();
- static string GetLocalHostIp();
- protected:
- struct sockaddr_in m_sa;
- };
- #endif //_NETADDRESS_H