简体   繁体   English

Windows的Erlang:节点错误?

[英]Erlang for Windows: Nodes Error?

I'm using Erlang for the first time, and when I tried to create a node, it bugged out. 我第一次使用Erlang,当我尝试创建一个节点时,它就出错了。 According to the manual, this should work, but that may be linux. 根据手册,这应该可以,但是可能是linux。

Do i have to initialize something on Windows for nodes to work? 我必须在Windows上初始化一些东西才能使节点工作吗?

Erlang/OTP 18 [erts-7.1] [64-bit] [smp:4:4] [async-threads:10]

Eshell V7.1  (abort with ^G)
1> erl -sname ping
1> node().        
* 1: syntax error before: ping
1> node().
nonode@nohost
2> 

The erl -sname ping command is what you run to start Erlang. 使用erl -sname ping命令可以启动Erlang。 Here, you entered it instead at the Erlang shell prompt, which is incorrect. 在这里,您在Erlang shell提示符下输入了它,这是不正确的。

You should start over by first exiting this Erlang shell either by typing q(). 您应该首先通过键入q().退出此Erlang Shell重新开始q(). followed by Enter , or by pressing Ctrl g and then at the next prompt typing q followed by enter Enter . 然后按Enter键 ,或者按Ctrl g ,然后在下一个提示符下键入q然后按Enter键 This should get you back out to your Windows shell. 这应该使您回到Windows Shell。 Then, enter erl -sname ping and once you get the Erlang shell 1> prompt again, you can run the node(). 然后,输入erl -sname ping ,再次获得Erlang shell 1>提示符后,即可运行node(). function. 功能。

The erl -sname is command line for creating and naming a node. erl -sname是用于创建和命名节点的命令行。 -sname stands for shortname and is used to name/identify nodes on same machine or same subnet on different machine.Once u start ERTS by erl -sname ping ,you are naming the node as ping and thereafter doing node() will give you ping@nohost instead of noname@nohost.You can find more details in Distributed Progrmming chapter of Joe Armstrong Erlang book http://www.amazon.in/Programming-Erlang-Joe-Armstrong/dp/9351104672/ref=sr_1_2?ie=UTF8&qid=1445756132&sr=8-2&keywords=erlang+book .The book is an excellent for beginers. -sname代表短名称,用于命名/识别同一台计算机上或不同计算机上同一子网中的节点。一旦您通过erl -sname ping启动ERTS,您将节点命名为ping,然后执行node()将给您ping @nohost代替noname @ nohost。您可以在Joe Armstrong Erlang的分布式编程一章中找到更多详细信息,该书http://www.amazon.in/Programming-Erlang-Joe-Armstrong/dp/9351104672/ref=sr_1_2?ie= UTF8&qid = 1445756132&sr = 8-2&keywords = erlang + book 。对于初学者来说,这本书是一本好书。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM