A record is actually another form of a tuple. By using records, you can associate a name for each element in a tuple.A mapping group is a collection of associations of key-value pairs. The key can be any of the Erlang data types.When to use a mapping group or recordRecords are another form of tuples, so they are stored in the same way as performance characteristics and tuples. The mapping group takes up more storage space than the tuple, and it looks
There are two models of Erlang distributed programmingFirst, distributed ErlangRunning in a trusted network environment1. Remote procedure call provided by RPCRpc:call (Node,mode,fun,args)->result| {Badrpc,reason}2. Functions in global can be used to register names and locks in distributed systems, and to maintain a fully connected networkSpawn (Node,fun), PidSpawn (Node,mode,fun,args)->pidSpawn_link (Node,fun), PidSpawn_link (Node,mode,fun,args)->pid
original articles, reproduced please specify the Source: Server non-amateur research http://blog.csdn.net/erlib author SunfaceContact e-mail: [Email protected]1. Get all the atoms in the loaded module33> beam_lib:chunks (FAC, [atoms]). {OK,{FAC,[{ATOMS,[{1,FAC}, {2,state}, {3,erlang}, {4, '-'}, {5, ' * '}, {6,module_info}, {7,get_module_info}]}]}}2. A
EPMD is the daemon of the port mapping between Erlang cluster nodes, which is responsible for maintaining the node connection in the cluster , providing the node name to IP address and Port resolution service. EPMD Custom Port numbersEPMD Port ConfigurationBy default, EPMD is bound to Port 4369. However, if the port is fixed, it is vulnerable to attack, which may cause the authentication of the new node to fail to start or to join the cluster.
Erlang Port beware of line breaks(Kyung's Column)The port interface of Erlang uses CIN and cout communicates with the external port process.General Open_port () is opened in binary mode.Port = Open_port ({spawn, portexe},[{packet, 4}, Binary, Use_stdio]),Be careful at this point that the port process will automatically add \ r before outputting \ n on Windows.Portexe Send:
In Erlang ' _ ' is a special variable (in fact Erlang should not be called "change" amount, take care of the habit, let's call it), it can replace anything, it is very useful in match, for example:Erlang Code
{A, _, [B|_], {B}} = {ABC, +, [+], {] }
This means that _ is treated as a placeholder, indicating that there is a value in match, but I don't care what he is.In
Erlang OTP is a complete and reliable large-scale library, is a great success of the predecessors; now try the application inets Web server httpd, write a code call Inets service:1 -module(INETS_HTTPD). 2 -export([start/0]). 3 4 Start ()5 inets:start (),6 Inets:start (httpd, [{bind_ Address, {192,168,178,130}}, {ipfamily, inet}, {port, 18080}, {service_admin, "[Email protected]"}, {server_name, " Whyang.yang.net "}, {server_root,". "}, {Server_
Erlang supports monitor and link two monitoring processes so that all processes can be connected as a whole. When a process exits with an error, the monitoring process receives a message notification that the process exits. With these features, it is not difficult to build a simple, robust system using Erlang. In the previous article, we analyzed the usage of two methods, and analyzed the implementation of
Erlang was the first language to be developed for telecom products, and because of that, it decided her strict requirements for error handling. In addition to providing syntax such as Exception,try catch, Erlang also supports the mechanism of link and monitor two monitoring processes so that all processes can be joined together to form a whole. When a process exits with an error, the other process receives
To register a process, you must first create a process.How to create a process that can use Spawn, spawn_link, although they can all create a process, but there are subtle differences (find a book, query the Erlang process set, have spawn_link detailed usage):1) A parallel process is created in the current process, and the current process will not be aware when the generated process crashesPid = Spawn (fun).2) If the process created by the current pro
Problem Description: A performance problem occurs in a production environment where a and b two nodes run on two servers, A and B interconnect, and a continuously sends messages to B. The machine on which the B node is located is down, causing the process of sending messages in a node to gamble on messages.Tracing process: Through Erlang:process_info (Erlang:whereis (Pid)) Discovery Current_function has been GEN:DO_CALL/4. Messages messages accumulate to level hundreds of thousands of. SOURCE an
In Erlang shell, end an expression with a period with a space, tab, or carriage return,% to indicate the starting point of the comment, and the quarantine clause. The module is a. erl file, the header file of the library. HRL, compile-time C () in the shell, ERLC when the command is compiled outside, exit the shell with Q (), or Erlang:halt ().
Variables begin with uppercase letters and cannot be rebind, and can only be assigned at once, with immutab
From: http://blog.csdn.net/liuxuezong/article/details/7666153
First, HelloWorld of Erlang
1. Start with Hello World
%%%helloworld.erl
-module (HelloWorld).
-export ([RUN/1]).
Run (name), Io:format ("Hello world,~w~n", [name]).
2. Save as Helloworld.erl and execute in Erlang shell.
Erlang r15b01 (erts-5.9.1) [Smp:4:4] [async-threads:0]
Eshell V5.9.1 (abort wit
Label: Erlang??
Original article, reprinted with the source: Server non-amateur researchSunface by http://blog.csdn.net/erlib
Project Structure
The structures of OTP applications and of OTP releases are different. an OTP application can be expected to have one top-level supervisor (if any) and possibly a bunch of dependencies that sit below it. an OTP release will usually be composed of multiple OTP applications, which may or may not depend on each o
In the development process, there are two concepts related to the regional area: character encoding and time; the evolution of the Code and Time specification has a historical legacy, and it is a corner of the development of software. About character encoding I've worked on a post before, [Erlang 0024] Erlang binary Data processing this part of the knowledge is very interesting, in particular, Gulliver's tr
Recently saw Sunface "Why I choose Erlang+go Server Architecture", feel erlang+go is really the monster of the service side, In particular, after doing some of the node. JS, I think node concurrency is really not good, compared to. NET (and of course, the great God says that if you say. NET is not concurrent, that is, you do not use. NET) is a lot faster. But I have to admit that my love for. NET has passed
recently a friend wanted to learn Erlang and asked me what I could do to get started. I'd also take this opportunity to tidy up: http://download.csdn.net/detail/cwqcwk1/8395531Entry Information:Erlang Documentation Manual (best for Getting started)Introduction to Erlang programmingErlang bit arithmetic and binary parsingErlang binary Efficient programmingAn explanation of
Introduction to Erlang Distributed (i)-ping pongTest environments like http://willvvv.iteye.com/blog/1523918, 192.168.0.182 (centos-182) and 192.168.0.183 (centos-183),1. Follow the link above (step 1-4) to set up a password-free login via ssh hostname.2. Set the Magiccookie of Erlang, as the root account, the following commands are executed on both machines:Cd/rootVI. Erlang.cookieInputShell Code
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.