sipb_ipaddr.cpp
来自「sip torture test tools」· C++ 代码 · 共 29 行
CPP
29 行
//sipb_ipaddr.cpp//Copyright (C) 2003 Metalink LTD//Author: Rodionov Sergey (seger@metalinkltd.com)//This program is distributed under terms of GPL (see LICENSE)#include "sipb_ipaddr.h"#include <netdb.h>sipb_ipaddr::sipb_ipaddr(){ if (!try_set("127.0.0.1")) //network is unrechable { _ip.s_addr=INADDR_ANY; _strip="0.0.0.0"; }}// bool sipb_ipaddr::try_set(string str){ hostent *hostinfo=gethostbyname(str.c_str()); if (hostinfo==NULL) return false; _strip=str; _ip=*(struct in_addr*)hostinfo->h_addr; return true;}//
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?