Linking two Pids of nodes that are in the same machine - noconnection signal!

Valentin Micic valentin@REDACTED
Sat Oct 2 02:44:22 CEST 2004


You may achieve this using following steps:

1)  Open your local host file -- for windows that would be under C:\WINDOWS\system32\drivers\etc\hosts (make sure that you're using the right HOSTS file)
2)  Add an alias to the localhost and save changes i.e.
        127.0.0.1  localhost theErlangHost
3) Start erlang using:
    erl -sname node1@REDACTED


This will force any other local erlang node to connect using 127.0.0.1

In order to allow remote nodes to connect as well, you would need to configure remote host file like this:

192.168.0.30 theErlangHost

which will allow remote nodes to come in using the LAN interface.


EXPLANATION:

If you run command  "epmd -names" the epmd will return list of names and associated port numbers, for example:

epmd: up and running on port 4369 with data:
name node1 at port 3527
name node2 at port 3513

If you then go and chack the listeners for these ports, you're likely to find something like this:

TCP    0.0.0.0:3513           0.0.0.0:0              LISTENING
TCP    0.0.0.0:3527           0.0.0.0:0              LISTENING

This means that transport layer supports any available incoming interface, thus everything is in address resolution:
Local node will resolve theErlangHost as 127.0.0.1, whislt remote shall use 192.168.0.30.
The important thing is to keep the symbolic host name the same, as it is used by net-kernel. (It is interesting though, that hidden C-nodes are not required to use the symbolic host names -- plain IP address does the trick).

The same is true for other operating systems as well.

Tell me if this makes any sense to you.

Valentin.

PS
Funny thing is that I've been discussing similar (yet completely different thing) with Francesco yesterday, and he suggested startup syntax  erl -sname sys@REDACTED
It did not help me solve my problem -- no matter what I've tried it resulted in failure. However, the consequences of these failure is the above -- I'd be very pleased if it can help you.

BTW: anybody knows how to force a single erlang run-time to support two, or more internal hostnames, i.e.

If I have two interfaces:

10.0.0.2    host_private
198.1.2.3  host_public

How can I start node1 in such a way that both 

rpc:call( 'node1@REDACTED', os, type, []).
and
rpc:call( 'node1@REDACTED', os, type, []).

connect to the same node1?



    

  ----- Original Message ----- 
  From: Inswitch Solutions - Erlang Evaluation 
  To: erlang-questions@REDACTED 
  Sent: Friday, October 01, 2004 2:36 PM
  Subject: Re: Linking two Pids of nodes that are in the same machine - noconnection signal!



  I'll try to explain the problem from another point of view.
  The machine I'm using is named design (IP=192.168.0.30).

  In Windows 2000:
  With LAN cable disconnected:
  ping design
  Response from 127.0.0.1: bytes=32 tieme<10ms TTL=128

  With LAN cable connected:
  ping design
  Response from 192.168.0.30: bytes=32 tieme<10ms TTL=128


  Having two Erlang nodes in the same machine the TCP socket connections are different:
  1- if LAN cable disconnected the connection between nodes is established using 127.0.0.1:PORT 
  2- if LAN cable connected the connection between nodes is established using 192.168.0.30:PORT

  The problem is that in situation 2) and then if the LAN cable is disconnected the connections established with 192.168.0.30:PORT are lost. This can be also verified when "ping design" in W2000 command prompt.

  - Can I force Erlang to use 127.0.0.1 for local nodes connection instead of 192.168.0.30 ?
  - How can I solve this problem so not to lose local connections in any case?
  - Does the same behaviour happen in other OS?


  thanks in advance,
  Eduardo Figoli
  INSwitch Solutions

    ----- Original Message ----- 
    From: Inswitch Solutions - Erlang Evaluation 
    To: erlang-questions@REDACTED 
    Sent: Thursday, September 30, 2004 10:46 AM
    Subject: Linking two Pids of nodes that are in the same machine - noconnection signal!



    The attached code links to pids of nodes that are in the same machine and I don't know why I receive a noconnection signal when the LAN cable is disconnected. This does no happen when running the code with the LAN cable disconnected and connecting/disconnecting it later.

    If someone wants to give a try,  I send a code to test this situation and you should modify on node1.erl the blue text line below:
    {node2Pid, node2@REDACTED} ! {self()},
    with the corresponding machine name where you will run it.


    On the same machine do the following:

    1 - "erl -sname node2"
    2 - "node2:start()."

    2 - "erl -sname node1"
    3 - "node1:start()."
     
    4 - The pid is linked and a message is shown on node1.
    5 - node2Pid shows a message every 1 sec while checking the queue message
    6 - node1 process loops checking the queue message 

    7 - Disconnect LAN cable
    8 - node2Pid receives a noconnection signal
    9 - node1 process receives an {'EXIT',Pid,noconnection}


    - When linking Pids of different nodes that are in the same machine why do I receive a "noconnection" signal?
    - Having the LAN cable disconnected and doing steps 1..6 8..9, if I connect/disconnect the LAN cable the "noconnection" signal is never received (correct behaviour). 
    - If in the source code I do not use "process_flag(trap_exit, true),"  the processes terminate, why is this happenning as no kill signal is sent?


    thanks in advance,
    Eduardo Figoli
    INSwitch Solutions



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20041002/890afd58/attachment.htm>


More information about the erlang-questions mailing list