[erlang-questions] JInterface and node discovery

Mats Cronqvist <>
Wed Dec 13 14:49:21 CET 2006


Vlad Dumitrescu wrote:
> On 12/13/06, Mats Cronqvist <> wrote:
>>
>> Vlad Dumitrescu wrote:
>> > The version of jinterface used in the Erlide project (erlide.sf.net)
>> > contains a method to query the epmd server for all the registered node
>> > names.
>>
>>    that looked very nice! now, for the java-impaired, could you quickly
>> translate it to erlang? or was it based on some erlang code?
>>
> 
> Hi,
> 
> Yes, I could :-)

   for documentation purposes;

1> Epmd = fun() ->
    {ok,Sock} = gen_tcp:connect("localhost",4369,[list,{active,false},{packet,0}]),
    gen_tcp:send(Sock,<<0,1,110>>),
    {ok,[_,_,_,_|R]} = gen_tcp:recv(Sock,0),
    gen_tcp:close(Sock),
    string:tokens(R,"\n")
   end.

2> Epmd().
["name foog at port 35700",
  "name dgen at port 35247",
  "name sherk_3551 at port 34706"]

   is it just me or is the erlang version significantly shorter? :>

   mats



More information about the erlang-questions mailing list