小编Bum*_*Bee的帖子

查找负责邮件域的提供商

供应商,我的意思是负责邮件的供应商,例如gmail 供应商将是gmail(或/由谷歌),而microsoft.com它将会是outlook(由微软)。

基本上,我想找出给定的电子邮件域,例如abc@xyz.comhxy@tuv.com在我们的案例中来自特定的提供商(outlook 或 gmail),因为它属于哪个提供商,xyz或者tuv不明确。

我取得了一些成功,我的想法是利用MX记录,所以我在 nodejs 中做了这样的事情:

const dnsMod = require('dns');

dnsMod.resolveMx(
    'mydomain.com', (err, value)=>{
        console.log('The error is : ', err);
        console.log('The value is : ', value);
    }
)  
Run Code Online (Sandbox Code Playgroud)

它返回这样的记录:

[
  { exchange: 'alt3.gmail-smtp-in.l.google.com', priority: 30 },
  { exchange: 'alt1.gmail-smtp-in.l.google.com', priority: 10 },
  { exchange: 'gmail-smtp-in.l.google.com', priority: 5 },
  { exchange: 'alt2.gmail-smtp-in.l.google.com', priority: 20 },
  { exchange: 'alt4.gmail-smtp-in.l.google.com', priority: 40 }
] …
Run Code Online (Sandbox Code Playgroud)

dns node.js

6
推荐指数
1
解决办法
112
查看次数

c中的间接水平

亲爱的明智的堆栈交换器,我已经把自己长达8个小时的连续思考,但仍然无法找出以下代码的正确解释:

#define __STDC_WANT_LIB_EXT1__ 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    char** pWords = calloc(10, sizeof(char*));


    *(pWords + 1) = malloc(10);

    strcpy_s(*(pWords + 1), 10, "Test sent\0");

    printf("The string is: %s", *(pWords + 1));

    return 0;

}  
Run Code Online (Sandbox Code Playgroud)

这个输出是:

The string is: Test sent
Run Code Online (Sandbox Code Playgroud)

我已将内存分配解释为:

+-------+-------+-------+-------+......
|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|......
+-------+-------+-------+-------+......
^       ^
|       |
|       |
pointer(let) <-------malloc(10)
|
|
pWords  <------calloc(10, sizeof(char*))  
Run Code Online (Sandbox Code Playgroud)

我基本上不理解涉及间接级别和指针的部分:

首先,pWords被声明为指针的指针.(我认为它就是pointer例如.然后只使用一个"*"符号就会引用这个pointer,对吧?那么pWord在初始化时会指向什么:calloc(10, sizeof(char*))
为什么会*(pWords + 1)用来访问指针的内容那是用两个间接级别声明的**吗?不应该是 **(pWords + …

c pointers

1
推荐指数
1
解决办法
762
查看次数

标签 统计

c ×1

dns ×1

node.js ×1

pointers ×1