📄 d114.bmp.txt
字号:
,,产生错误
sHostName=_-T(”没有取得”);
return GetLastError();
)
sHostName=szHostName;
returnO:
9)添加CChatClient类获取主机IP地址函数GetIpAddress()。
//4
int CChatClient::GetlpAddress(const CString &sHostName, CString &slpAddress)
{
struct hostent FAR * lpHostEnt=gethostbyname(sHostName);
if(lpHostEnt-NULL)
{
//产生错误
slpAddress=_T("");
retum GetLastError0;
}
/,获取 lP
LPSTR lpAddr=lpHostEnt->h_addr_list[01;
if(lpAddr)
{
struct in_addr inAddr;
memmove(&inAddr,lpAddr,4);
sIpAddress=inet_ntoa(inAddr);
if(sIpAddress.IsEmpty0)
slpAddress=_T("没有取得”);
}
return 0;
}
int CChatCljent:GetIpAddress(const CString &sHostName, BYTE &fj, BYTE &fl, BYTE &f2, BYTE &f3)
{
struct hostent FAR *lpHostEnt=gethostbyname(sHostName);
if(lpHostEnt=NULL)
{
,/产生错误
fD=fl=f2=f3=0;
retum GetLastError0;
}
,,获取 IP
LPSTR lpAddr=lpHostEnt->h_addr_listlOl;
if(lpAddr)
{
struct in_addr inAddr;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -