一、概述

现在来搞定DNS域名解析,其实这是前面一篇文章C++实现Ping里面的遗留问题,要干的活是ping的过程中画红线的部分:

cmd下域名解析的命令是nslookup,比如“nslookup www.baidu.com”的结果如下:

其中,Address返回的就是www.baidu.com对应的IP地址,这个可能有多个

Alias指别名,也就是说www.baidu.com是www.a.shifen.com的别名,而www.a.shifen.com则是www.baidu.com的规范名(Canonical Name,CName),具体参考RFC1035 3.2.2 & wikipedia

 [转载请保留本文地址:http://www.cnblogs.com/goagent/p/4101729.html] 

二、实现结果预览

先看一下最终搞成了什么样子

输入:域名字符串

输出:IP列表、CName列表、DNS查询所用时间

 

[转载请保留本文地址:http://www.cnblogs.com/goagent/p/4101729.html] 

三、相关技术

3.1、UDP or TCP ? (RFC1035 4.2)

UDP:DNS查询和回复采用低开销高性能的UDP,端口号为53。

TCP:辅助DNS服务器从主DNS服务器拉取最新数据时,采用可靠的TCP传输,端口号也为53。

我们这里做DNS查询采用UDP,53端口。

3.2、DNS查询/回复包头部解析 (RFC1035 4.1.1)

重点介绍一下我们关心的部分:

ID(16bits):标识符,一般填入本进程的标识符

QR(1bits):标志位,查询包为0,回复包为1

Opcode(4bits):查询的种类,标准查询为0

QDCOUNT(16bits):DNS查询/回复包数据部分Question字段的个数

ANCOUNT(16bits):DNS查询/回复包数据部分Answer字段的个数

3.2、DNS查询/回复包数据部分解析 (RFC1035 4.1.2 & 4.1.3)

查询/回复包的数据部分依次为QDCOUNT个Question字段、ANCOUNT个Answer字段....

对于任意字段,其格式如下:

Name(不定长):域名,这部分的格式比较复杂,后面单独说。

TYPE(16bits):查询类型/回复包RDATA类型,比如TYPE=1表示主机IP地址、TYPE=5表示CNAME,详见RFC1035 3.2.2

CLASS(16bits):类,一般情况下CLASS=1表示Internet,详见RFC1035 3.2.4

TTL(32bits,仅回复包):生存时间

RDLENGTH(16bits,仅回复包):RDATA部分的字节数

RDATA(不定长,仅回复包):资源数据,具体格式取决于TYPE和CLASS,比如TYPE=1、CLASS=1时,RDATA为四个字节的IP地址

3.3、Name解析&消息压缩

3.3.1、一般格式 (RFC1035 4.1.2)

标签内容长度(1个字节) + 标签内容,以标签内容长度0作为Name的结束符,例如:

3.3.2、消息压缩格式 (RFC1035 4.1.4)

如果标签内容长度的二进制前两位是11,则表示消息压缩。

此时,标签内容长度1个字节+后面的1个字节一共16位,后14位表示相对DNS包起始地址的偏移(Byte),例如:

上述例子中,DNS包起始地址为0x0000,c0 13的二进制为11000000 00010003,即跳转偏移为0x13个字节,对应的数据为03 63 6f 6d 00。

RFC1035中规定,支持的消息压缩规则为:

①以内容长度0结尾的标签序列

②偏移指针

③标签序列+偏移指针

也就是说,Name的消息压缩要求偏移指针必须在Name的尾部,且不支持同一级存在多个偏移指针(偏移指针序列),

但Name的消息压缩支持嵌套的偏移指针,即指针指向的偏移位置仍然是以偏移指针结尾的数据

 [转载请保留本文地址:http://www.cnblogs.com/goagent/p/4101729.html] 

四、代码实现

 #pragma once

 //这里需要导入库 Ws2_32.lib,在不同的IDE下可能不太一样
//#pragma comment(lib, "Ws2_32.lib") #include <windows.h>
#include <string>
#include <vector> #define MAX_DOMAINNAME_LEN 255
#define DNS_PORT 53
#define DNS_TYPE_SIZE 2
#define DNS_CLASS_SIZE 2
#define DNS_TTL_SIZE 4
#define DNS_DATALEN_SIZE 2
#define DNS_TYPE_A 0x0001 //1 a host address
#define DNS_TYPE_CNAME 0x0005 //5 the canonical name for an alias
#define DNS_PACKET_MAX_SIZE (sizeof(DNSHeader) + MAX_DOMAINNAME_LEN + DNS_TYPE_SIZE + DNS_CLASS_SIZE) struct DNSHeader
{
USHORT usTransID; //标识符
USHORT usFlags; //各种标志位
USHORT usQuestionCount; //Question字段个数
USHORT usAnswerCount; //Answer字段个数
USHORT usAuthorityCount; //Authority字段个数
USHORT usAdditionalCount; //Additional字段个数
}; class CDNSLookup
{
public:
CDNSLookup();
~CDNSLookup(); BOOL DNSLookup(ULONG ulDNSServerIP, char *szDomainName, std::vector<ULONG> *pveculIPList = NULL, std::vector<std::string> *pvecstrCNameList = NULL, ULONG ulTimeout = , ULONG *pulTimeSpent = NULL);
BOOL DNSLookup(ULONG ulDNSServerIP, char *szDomainName, std::vector<std::string> *pvecstrIPList = NULL, std::vector<std::string> *pvecstrCNameList = NULL, ULONG ulTimeout = , ULONG *pulTimeSpent = NULL); private:
BOOL Init();
BOOL UnInit();
BOOL DNSLookupCore(ULONG ulDNSServerIP, char *szDomainName, std::vector<ULONG> *pveculIPList, std::vector<std::string> *pvecstrCNameList, ULONG ulTimeout, ULONG *pulTimeSpent);
BOOL SendDNSRequest(sockaddr_in sockAddrDNSServer, char *szDomainName);
BOOL RecvDNSResponse(sockaddr_in sockAddrDNSServer, ULONG ulTimeout, std::vector<ULONG> *pveculIPList, std::vector<std::string> *pvecstrCNameList, ULONG *pulTimeSpent);
BOOL EncodeDotStr(char *szDotStr, char *szEncodedStr, USHORT nEncodedStrSize);
BOOL DecodeDotStr(char *szEncodedStr, USHORT *pusEncodedStrLen, char *szDotStr, USHORT nDotStrSize, char *szPacketStartPos = NULL);
ULONG GetTickCountCalibrate(); private:
BOOL m_bIsInitOK;
SOCKET m_sock;
WSAEVENT m_event;
USHORT m_usCurrentProcID;
char *m_szDNSPacket;
};

[DNSLookup.h]

 #include "DNSLookup.h"
#include <stdio.h>
#include <string.h> CDNSLookup::CDNSLookup() :
m_bIsInitOK(FALSE),
m_sock(INVALID_SOCKET),
m_szDNSPacket(NULL)
{
m_bIsInitOK = Init();
} CDNSLookup::~CDNSLookup()
{
UnInit();
} BOOL CDNSLookup::DNSLookup(ULONG ulDNSServerIP, char *szDomainName, std::vector<ULONG> *pveculIPList, std::vector<std::string> *pvecstrCNameList, ULONG ulTimeout, ULONG *pulTimeSpent)
{
return DNSLookupCore(ulDNSServerIP, szDomainName, pveculIPList, pvecstrCNameList, ulTimeout, pulTimeSpent);
} BOOL CDNSLookup::DNSLookup(ULONG ulDNSServerIP, char *szDomainName, std::vector<std::string> *pvecstrIPList, std::vector<std::string> *pvecstrCNameList, ULONG ulTimeout, ULONG *pulTimeSpent)
{
std::vector<ULONG> *pveculIPList = NULL;
if (pvecstrIPList != NULL)
{
std::vector<ULONG> veculIPList;
pveculIPList = &veculIPList;
} BOOL bRet = DNSLookupCore(ulDNSServerIP, szDomainName, pveculIPList, pvecstrCNameList, ulTimeout, pulTimeSpent); if (bRet)
{
pvecstrIPList->clear();
char szIP[] = {'\0'};
for (std::vector<ULONG>::iterator iter = pveculIPList->begin(); iter != pveculIPList->end(); ++iter)
{
BYTE *pbyIPSegment = (BYTE*)(&(*iter));
//sprintf_s(szIP, 16, "%d.%d.%d.%d", pbyIPSegment[0], pbyIPSegment[1], pbyIPSegment[2], pbyIPSegment[3]);
sprintf(szIP, "%d.%d.%d.%d", pbyIPSegment[], pbyIPSegment[], pbyIPSegment[], pbyIPSegment[]);
pvecstrIPList->push_back(szIP);
}
} return bRet;
} BOOL CDNSLookup::Init()
{
WSADATA wsaData;
if (WSAStartup(MAKEWORD(, ), &wsaData) == SOCKET_ERROR)
{
return FALSE;
} if ((m_sock = socket(AF_INET, SOCK_DGRAM, )) == INVALID_SOCKET)
{
return FALSE;
} m_event = WSACreateEvent();
WSAEventSelect(m_sock, m_event, FD_READ); m_szDNSPacket = new (std::nothrow) char[DNS_PACKET_MAX_SIZE];
if (m_szDNSPacket == NULL)
{
return FALSE;
} m_usCurrentProcID = (USHORT)GetCurrentProcessId(); return TRUE;
} BOOL CDNSLookup::UnInit()
{
WSACleanup(); if (m_szDNSPacket != NULL)
{
delete [] m_szDNSPacket;
} return TRUE;
} BOOL CDNSLookup::DNSLookupCore(ULONG ulDNSServerIP, char *szDomainName, std::vector<ULONG> *pveculIPList, std::vector<std::string> *pvecstrCNameList, ULONG ulTimeout, ULONG *pulTimeSpent)
{
if (m_bIsInitOK == FALSE || szDomainName == NULL)
{
return FALSE;
} //配置SOCKET
sockaddr_in sockAddrDNSServer;
sockAddrDNSServer.sin_family = AF_INET;
sockAddrDNSServer.sin_addr.s_addr = ulDNSServerIP;
sockAddrDNSServer.sin_port = htons( DNS_PORT ); //DNS查询与解析
if (!SendDNSRequest(sockAddrDNSServer, szDomainName)
|| !RecvDNSResponse(sockAddrDNSServer, ulTimeout, pveculIPList, pvecstrCNameList, pulTimeSpent))
{
return FALSE;
} return TRUE;
} BOOL CDNSLookup::SendDNSRequest(sockaddr_in sockAddrDNSServer, char *szDomainName)
{
char *pWriteDNSPacket = m_szDNSPacket;
memset(pWriteDNSPacket, , DNS_PACKET_MAX_SIZE); //填充DNS查询报文头部
DNSHeader *pDNSHeader = (DNSHeader*)pWriteDNSPacket;
pDNSHeader->usTransID = m_usCurrentProcID;
pDNSHeader->usFlags = htons(0x0100);
pDNSHeader->usQuestionCount = htons(0x0001);
pDNSHeader->usAnswerCount = 0x0000;
pDNSHeader->usAuthorityCount = 0x0000;
pDNSHeader->usAdditionalCount = 0x0000; //设置DNS查询报文内容
USHORT usQType = htons(0x0001);
USHORT usQClass = htons(0x0001);
USHORT nDomainNameLen = strlen(szDomainName);
char *szEncodedDomainName = (char *)malloc(nDomainNameLen + );
if (szEncodedDomainName == NULL)
{
return FALSE;
}
if (!EncodeDotStr(szDomainName, szEncodedDomainName, nDomainNameLen + ))
{
return FALSE;
} //填充DNS查询报文内容
USHORT nEncodedDomainNameLen = strlen(szEncodedDomainName) + ;
memcpy(pWriteDNSPacket += sizeof(DNSHeader), szEncodedDomainName, nEncodedDomainNameLen);
memcpy(pWriteDNSPacket += nEncodedDomainNameLen, (char*)(&usQType), DNS_TYPE_SIZE);
memcpy(pWriteDNSPacket += DNS_TYPE_SIZE, (char*)(&usQClass), DNS_CLASS_SIZE);
free (szEncodedDomainName); //发送DNS查询报文
USHORT nDNSPacketSize = sizeof(DNSHeader) + nEncodedDomainNameLen + DNS_TYPE_SIZE + DNS_CLASS_SIZE;
if (sendto(m_sock, m_szDNSPacket, nDNSPacketSize, , (sockaddr*)&sockAddrDNSServer, sizeof(sockAddrDNSServer)) == SOCKET_ERROR)
{
return FALSE;
} return TRUE;
} BOOL CDNSLookup::RecvDNSResponse(sockaddr_in sockAddrDNSServer, ULONG ulTimeout, std::vector<ULONG> *pveculIPList, std::vector<std::string> *pvecstrCNameList, ULONG *pulTimeSpent)
{
ULONG ulSendTimestamp = GetTickCountCalibrate(); if (pveculIPList != NULL)
{
pveculIPList->clear();
}
if (pvecstrCNameList != NULL)
{
pvecstrCNameList->clear();
} char recvbuf[] = {'\0'};
char szDotName[] = {'\0'};
USHORT nEncodedNameLen = ; while (TRUE)
{
if (WSAWaitForMultipleEvents(, &m_event, FALSE, , FALSE) != WSA_WAIT_TIMEOUT)
{
WSANETWORKEVENTS netEvent;
WSAEnumNetworkEvents(m_sock, m_event, &netEvent); if (netEvent.lNetworkEvents & FD_READ)
{
ULONG ulRecvTimestamp = GetTickCountCalibrate();
int nSockaddrDestSize = sizeof(sockAddrDNSServer); //接收响应报文
if (recvfrom(m_sock, recvbuf, , , (struct sockaddr*)&sockAddrDNSServer, &nSockaddrDestSize) != SOCKET_ERROR)
{
DNSHeader *pDNSHeader = (DNSHeader*)recvbuf;
USHORT usQuestionCount = ;
USHORT usAnswerCount = ; if (pDNSHeader->usTransID == m_usCurrentProcID
&& (ntohs(pDNSHeader->usFlags) & 0xfb7f) == 0x8100 //RFC1035 4.1.1(Header section format)
&& (usQuestionCount = ntohs(pDNSHeader->usQuestionCount)) >=
&& (usAnswerCount = ntohs(pDNSHeader->usAnswerCount)) > )
{
char *pDNSData = recvbuf + sizeof(DNSHeader); //解析Question字段
for (int q = ; q != usQuestionCount; ++q)
{
if (!DecodeDotStr(pDNSData, &nEncodedNameLen, szDotName, sizeof(szDotName)))
{
return FALSE;
}
pDNSData += (nEncodedNameLen + DNS_TYPE_SIZE + DNS_CLASS_SIZE);
} //解析Answer字段
for (int a = ; a != usAnswerCount; ++a)
{
if (!DecodeDotStr(pDNSData, &nEncodedNameLen, szDotName, sizeof(szDotName), recvbuf))
{
return FALSE;
}
pDNSData += nEncodedNameLen; USHORT usAnswerType = ntohs(*(USHORT*)(pDNSData));
USHORT usAnswerClass = ntohs(*(USHORT*)(pDNSData + DNS_TYPE_SIZE));
ULONG usAnswerTTL = ntohl(*(ULONG*)(pDNSData + DNS_TYPE_SIZE + DNS_CLASS_SIZE));
USHORT usAnswerDataLen = ntohs(*(USHORT*)(pDNSData + DNS_TYPE_SIZE + DNS_CLASS_SIZE + DNS_TTL_SIZE));
pDNSData += (DNS_TYPE_SIZE + DNS_CLASS_SIZE + DNS_TTL_SIZE + DNS_DATALEN_SIZE); if (usAnswerType == DNS_TYPE_A && pveculIPList != NULL)
{
ULONG ulIP = *(ULONG*)(pDNSData);
pveculIPList->push_back(ulIP);
}
else if (usAnswerType == DNS_TYPE_CNAME && pvecstrCNameList != NULL)
{
if (!DecodeDotStr(pDNSData, &nEncodedNameLen, szDotName, sizeof(szDotName), recvbuf))
{
return FALSE;
}
pvecstrCNameList->push_back(szDotName);
} pDNSData += (usAnswerDataLen);
} //计算DNS查询所用时间
if (pulTimeSpent != NULL)
{
*pulTimeSpent = ulRecvTimestamp - ulSendTimestamp;
} break;
}
}
}
} //超时退出
if (GetTickCountCalibrate() - ulSendTimestamp > ulTimeout)
{
*pulTimeSpent = ulTimeout + ;
return FALSE;
}
} return TRUE;
} /*
* convert "www.baidu.com" to "\x03www\x05baidu\x03com"
* 0x0000 03 77 77 77 05 62 61 69 64 75 03 63 6f 6d 00 ff
*/
BOOL CDNSLookup::EncodeDotStr(char *szDotStr, char *szEncodedStr, USHORT nEncodedStrSize)
{
USHORT nDotStrLen = strlen(szDotStr); if (szDotStr == NULL || szEncodedStr == NULL || nEncodedStrSize < nDotStrLen + )
{
return FALSE;
} char *szDotStrCopy = new char[nDotStrLen + ];
//strcpy_s(szDotStrCopy, nDotStrLen + 1, szDotStr);
strcpy(szDotStrCopy, szDotStr); char *pNextToken = NULL;
//char *pLabel = strtok_s(szDotStrCopy, ".", &pNextToken);
char *pLabel = strtok(szDotStrCopy, ".");
USHORT nLabelLen = ;
USHORT nEncodedStrLen = ;
while (pLabel != NULL)
{
if ((nLabelLen = strlen(pLabel)) != )
{
//sprintf_s(szEncodedStr + nEncodedStrLen, nEncodedStrSize - nEncodedStrLen, "%c%s", nLabelLen, pLabel);
sprintf(szEncodedStr + nEncodedStrLen, "%c%s", nLabelLen, pLabel);
nEncodedStrLen += (nLabelLen + );
}
//pLabel = strtok_s(NULL, ".", &pNextToken);
pLabel = strtok(NULL, ".");
} delete [] szDotStrCopy; return TRUE;
} /*
* convert "\x03www\x05baidu\x03com\x00" to "www.baidu.com"
* 0x0000 03 77 77 77 05 62 61 69 64 75 03 63 6f 6d 00 ff
* convert "\x03www\x05baidu\xc0\x13" to "www.baidu.com"
* 0x0000 03 77 77 77 05 62 61 69 64 75 c0 13 ff ff ff ff
* 0x0010 ff ff ff 03 63 6f 6d 00 ff ff ff ff ff ff ff ff
*/
BOOL CDNSLookup::DecodeDotStr(char *szEncodedStr, USHORT *pusEncodedStrLen, char *szDotStr, USHORT nDotStrSize, char *szPacketStartPos)
{
if (szEncodedStr == NULL || pusEncodedStrLen == NULL || szDotStr == NULL)
{
return FALSE;
} char *pDecodePos = szEncodedStr;
USHORT usPlainStrLen = ;
BYTE nLabelDataLen = ;
*pusEncodedStrLen = ; while ((nLabelDataLen = *pDecodePos) != 0x00)
{
if ((nLabelDataLen & 0xc0) == ) //普通格式,LabelDataLen + Label
{
if (usPlainStrLen + nLabelDataLen + > nDotStrSize)
{
return FALSE;
}
memcpy(szDotStr + usPlainStrLen, pDecodePos + , nLabelDataLen);
memcpy(szDotStr + usPlainStrLen + nLabelDataLen, ".", );
pDecodePos += (nLabelDataLen + );
usPlainStrLen += (nLabelDataLen + );
*pusEncodedStrLen += (nLabelDataLen + );
}
else //消息压缩格式,11000000 00000000,两个字节,前2位为跳转标志,后14位为跳转的偏移
{
if (szPacketStartPos == NULL)
{
return FALSE;
}
USHORT usJumpPos = ntohs(*(USHORT*)(pDecodePos)) & 0x3fff;
USHORT nEncodeStrLen = ;
if (!DecodeDotStr(szPacketStartPos + usJumpPos, &nEncodeStrLen, szDotStr + usPlainStrLen, nDotStrSize - usPlainStrLen, szPacketStartPos))
{
return FALSE;
}
else
{
*pusEncodedStrLen += ;
return TRUE;
}
}
} szDotStr[usPlainStrLen - ] = '\0';
*pusEncodedStrLen += ; return TRUE;
} ULONG CDNSLookup::GetTickCountCalibrate()
{
static ULONG s_ulFirstCallTick = ;
static LONGLONG s_ullFirstCallTickMS = ; SYSTEMTIME systemtime;
FILETIME filetime;
GetLocalTime(&systemtime);
SystemTimeToFileTime(&systemtime, &filetime);
LARGE_INTEGER liCurrentTime;
liCurrentTime.HighPart = filetime.dwHighDateTime;
liCurrentTime.LowPart = filetime.dwLowDateTime;
LONGLONG llCurrentTimeMS = liCurrentTime.QuadPart / ; if (s_ulFirstCallTick == )
{
s_ulFirstCallTick = GetTickCount();
}
if (s_ullFirstCallTickMS == )
{
s_ullFirstCallTickMS = llCurrentTimeMS;
} return s_ulFirstCallTick + (ULONG)(llCurrentTimeMS - s_ullFirstCallTickMS);
}

[DNSLookup.cpp]

 #include <stdio.h>
#include <windows.h>
#include "DNSLookup.h" int main(void)
{
char szDomainName[] = "www.baidu.com";
std::vector<ULONG> veculIPList;
std::vector<std::string> vecstrIPList;
std::vector<std::string> vecCNameList;
ULONG ulTimeSpent = ;
CDNSLookup dnslookup;
BOOL bRet = dnslookup.DNSLookup(inet_addr("114.114.114.114"), szDomainName, &vecstrIPList, &vecCNameList, , &ulTimeSpent); printf("DNSLookup result (%s):\n", szDomainName);
if (!bRet)
{
printf("timeout!\n");
return -;
} for (int i = ; i != veculIPList.size(); ++i)
{
printf("IP%d(ULONG) = %u\n", i + , veculIPList[i]);
}
for (int i = ; i != vecstrIPList.size(); ++i)
{
printf("IP%d(string) = %s\n", i + , vecstrIPList[i].c_str());
}
for (int i = ; i != vecCNameList.size(); ++i)
{
printf("CName%d = %s\n", i + , vecCNameList[i].c_str());
}
printf("time spent = %ums\n", ulTimeSpent); return ;
}

 [转载请保留本文地址:http://www.cnblogs.com/goagent/p/4101729.html] 

C++实现DNS域名解析的更多相关文章

  1. DNS域名解析过程

    图1-10是DNS域名解析的主要请求过程实例图. 如图1-10所示,当一个用户在浏览器中输入www.abc.com时,DNS解析将会有将近10个步骤,这个过程大体描述如下.当用户在浏览器中输入域名并按 ...

  2. 配置DNS域名解析服务器

    bind这个DNS域名解析服务器解析好后,执行下面的语句实现开启服务 named -c named.conf & -c指配置脚本named.conf的文件地址 named.conf主要有下面几 ...

  3. 域名下Web项目重定向出现DNS域名解析错误问题

    问题: 项目使用的是阿里云的ESC,前几天为IP地址添加了域名 发现发送正常请求时跳转没问题,但发送重定向请求时,页面就会出现DNS域名解析错误的情况 1.我在Tomcat的server.xml中配置 ...

  4. 每天进步一点点——负载均衡之DNS域名解析

    转载请说明出处:http://blog.csdn.net/cywosp/article/details/38017027     在上一篇文章(http://blog.csdn.net/cywosp/ ...

  5. 一张图看懂DNS域名解析全过程

    DNS域名解析是互联网上非常重要的一项服务,上网冲浪(还有人在用这个词吗?)伴随着大量DNS服务来支撑,而对于网站运营来说,DNS域名解析的稳定可靠,意味着更多用户的喜欢,更好的SEO效果和更大的访问 ...

  6. DNS域名解析过程,域名的认识

    DNS域名解析过程 参考知乎:https://www.zhihu.com/question/23042131 当你通过浏览器输入url访问资源时,会请求DNS解析域名成对应的IP地址,由IP地址在去与 ...

  7. 《linux就该这么学》第十四节课:第13章,部署DNS域名解析服务(bind服务)

    (借鉴请改动)  第十二章收尾  12.2.nfs网络文件系统 RHEL7默认安装了nfs,配置文件在  /etc/export  写入格式:共享目录    允许的客户端(参数)  ro        ...

  8. DNS域名解析之搭建公司内部域--技术流ken

    什么是DNS DNS( Domain Name System)是“域名系统”的英文缩写,是一种组织成域层次结构的计算机和网络服务命名系统,它用于TCP/IP网络,它所提供的服务是用来将主机名和域名转换 ...

  9. Cloudflare DNS 域名解析

    参考文章:Cloudflare DNS 域名解析 小白一枚,等我这几天搞定后就写.....

随机推荐

  1. .Net中的AOP读书笔记系列之AOP介绍

    返回<.Net中的AOP>系列学习总目录 本篇目录 AOP是什么? Hello,World! 小结 本系列的源码本人已托管于Coding上:点击查看,想要注册Coding的可以点击该连接注 ...

  2. 轻量级通信引擎StriveEngine —— C/S通信demo(附源码)

    前段时间,有几个研究ESFramework的朋友对我说,ESFramework有点庞大,对于他们目前的项目来说有点“杀鸡用牛刀”的意思,因为他们的项目不需要文件传送.不需要P2P.不存在好友关系.也不 ...

  3. [源码]Literacy 快速反射读写对象属性,字段

    Literacy 说明 Literacy使用IL指令生成方法委托,性能方面,在调用次数达到一定量的时候比反射高很多 当然,用IL指令生成一个方法也是有时间消耗的,所以在只使用一次或少数几次的情况,不但 ...

  4. salesforce 零基础学习(五十八)通过sObject的field返回其对应的基础类型

    项目中有时候会要求通过sObject的Field的type类型返回其对应的基本类型,然后对其进行相关的处理,创建sObject的field可以选择的type类型是固定多的. 上述类型可以转换成几种基本 ...

  5. iOS-推送,证书申请,本地推送

    介绍一点点背景资料 众所周知,使用推送通知是一个很棒的.给应用添加实时消息通知的方式.这样做的结局是,开发者和用户之间,彼此永远保持着一种令人愉悦的亲密关系. 然而不幸的是,iOS的推送通知并非那么容 ...

  6. sublime text 插件

    html-css-js prettify html5 anaconda pretty json JavaScript Completions SqlBeautifier Emmet Css Snipp ...

  7. 使用topshelf包装redis为windows服务

           Redis服务端目前用的是控制台程序运行,部署的时候能作为windows服务后台运行感觉更好.找到一篇文章Running Redis as a Windows Service,利用win ...

  8. 关于Sa系列用户不能登录,只能本地windows身份验证的说明

  9. SQL Server 远程连接出错~~~无法访问服务器

    异常处理汇总 ~ 修正果带着你的Net飞奔吧!http://www.cnblogs.com/dunitian/p/4599258.html 代理开一下 tcp/ip协议开一下 收工

  10. 在真机调试 iOS 应用:理解 Certificates, Identifiers & Profiles

    No matching provisioning profiles found. No matching code signing identity found. Your account alrea ...