mirror of
https://github.com/LX3JL/xlxd.git
synced 2026-04-07 23:43:43 +00:00
xlxd 1.2.4 / db 2.1.0
implement XLX interlink feature
This commit is contained in:
parent
4831ba8829
commit
2f9e8a8781
259 changed files with 2603 additions and 647 deletions
15
src/cip.cpp
15
src/cip.cpp
|
|
@ -24,21 +24,34 @@
|
|||
|
||||
#include "main.h"
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
#include "cip.h"
|
||||
|
||||
#include <netdb.h>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// constructors
|
||||
|
||||
CIp::CIp()
|
||||
{
|
||||
::memset(&m_Addr, 0, sizeof(m_Addr));
|
||||
m_Addr.sin_family = AF_INET;
|
||||
}
|
||||
|
||||
CIp::CIp(const char *sz)
|
||||
{
|
||||
::memset(&m_Addr, 0, sizeof(m_Addr));
|
||||
m_Addr.sin_family = AF_INET;
|
||||
// try xxx.xxx.xxx.xxxx first
|
||||
m_Addr.sin_addr.s_addr = inet_addr(sz);
|
||||
if ( m_Addr.sin_addr.s_addr == INADDR_NONE )
|
||||
{
|
||||
// otherwise try to resolve via dns
|
||||
hostent *record = gethostbyname(sz);
|
||||
if( record != NULL )
|
||||
{
|
||||
m_Addr.sin_addr.s_addr = ((in_addr * )record->h_addr)->s_addr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CIp::CIp(const struct sockaddr_in *sa)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue