正在阅读:VB学习:MX记录获取组件VB学习:MX记录获取组件

2004-03-10 09:52 出处:CSDN 作者:glling 责任编辑:linjixiong

  iQCount = 0
  iCount = Len(sDomain)
  ' While we haven't hit end-of-string
  While (iNdx <= iCount)
  ' Read a single char from our domain
  sChar = Mid(sDomain, iNdx, 1)
  ' If the char is a dot, then put our character count and the part of the string
  If (sChar = ".") Then
  sQName = sQName & Chr(iQCount) & sDotName
  iQCount = 0
  sDotName = ""
  Else
  sDotName = sDotName + sChar
  iQCount = iQCount + 1
  End If
  iNdx = iNdx + 1
  Wend

  sQName = sQName & Chr(iQCount) & sDotName
 
  MakeQName = sQName
  End Function
  Private Sub ParseName(dnsReply() As Byte, iNdx As Integer, sName As String)
  Dim iCompress As Integer ' Compression index (index into original buffer)
  Dim iChCount As Integer ' Character count (number of chars to read from buffer)
 
  ' While we didn't encounter a null char (end-of-string specifier)
  While (dnsReply(iNdx) <> 0)
  ' Read the next character in the stream (length specifier)
  iChCount = dnsReply(iNdx)
  ' If our length specifier is 192 (0xc0) we have a compressed string
  If (iChCount = 192) Then
  ' Read the location of the rest of the string (offset into buffer)
  iCompress = dnsReply(iNdx + 1)
  ' Call ourself again, this time with the offset of the compressed string
  ParseName dnsReply(), iCompress, sName
  ' Step over the compression indicator and compression index
  iNdx = iNdx + 2
  ' After a compressed string, we are done
  Exit Sub



察看评论详细内容 我要发表评论
作者笔名简短内容 发表时间
:

键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品