微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何在erlang中更改我的主机名

这是我的kvs.erl:

-module(kvs). -export([start/0,store/2,lookup/1]). start() -> register(kvs,spawn(fun() -> loop() end)). store(Key,Value) -> rpc({store,Key,Value}). lookup(Key) -> rpc({lookup,Key}). rpc(Q) -> kvs ! {self(),Q},receive {kvs,Reply} -> Reply end. loop() -> receive {From,{store,Value}} -> put(Key,{ok,Value}),From ! {kvs,true},loop(); {From,{lookup,Key}} -> From ! {kvs,get(Key)},loop() end.

当我启动erlang使用:erl -name zhao -setcookie abc

然后:rpc:call(fifar @ huihua.sohu-inc.com,kvs,store,[weather,cold])。

显示错误

具有多个运行接口的计算机上的Linux主机名parsing

networking上所有机器的主机名发现

当主机名是64个字符时,InetAddress.getLocalHost()返回错误的结果

System.getenv(“computername”)截断返回值

如何从IP(Linux)获取主机名?

(zhao@zjm1126.sohu-inc.com)1> rpc:call(fifar@huihua.sohu-inc.com,kvs,store,[weather,cold]). ** exception error: bad argument in an arithmetic expression in operator -/2 called as 'fifar@huihua.sohu' - 'inc.com'

我认为这是关于Linux主机名,

但是我使用这个linux shell:hostname -a

它不能显示“huihua.sohu-inc.com”

所以我能做什么,

谢谢

使用javaScript在Linux环境中获取Intranet中的客户端主机名

根据主机名dynamic的apache日志目录

Linux后缀configuration和主机名FQDN

有没有可能从一个没有DNS的IP地址parsing主机名?

如何在Windows 10通用应用程序的C#中获取本地主机名

看看错误描述你在二元运算符“ – ”上有一个错误。 你只需要改变

(zhao@zjm1126.sohu-inc.com)1> rpc:call(fifar@huihua.sohu-inc.com,cold]).

(zhao@zjm1126.sohu-inc.com)1> rpc:call('fifar@huihua.sohu-inc.com',cold]).

你会得到你的代码运行。 Erlang控制台将fifar@huihua.sohuinc.com视为两个不同的原子,并将fifar@huihua.sohu-inc.com看作是两个原子之间差异操作 。 我建议你遵循erlang 参考手册中的这个引用:

一个原子是一个文字一个名字的常量。 如果原子不是以小写字母开头,或者包含除字母数字字符,下划线(_)或@以外的其他字符,则应将原子括在单引号(')中。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐