[erlang-questions] badarg when registering httpd process?

Roger Lipscombe roger@REDACTED
Fri Jul 11 16:37:57 CEST 2014


I'm attempting to register an httpd process with a name (mainly so
that I can figure out the dynamically-assigned port number later).

I get badarg when I call register, as follows:

Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:12:12]
[async-threads:10] [kernel-poll:false]

Eshell V5.10.4  (abort with ^G)
1> application:start(inets).
ok
2> {ok, Pid} = inets:start(httpd, [{port, 0}, {server_name,
"localhost"}, {server_root, "/tmp"}, {document_root, "/tmp"}]).
{ok,<0.48.0>}
3> register(my_httpd, Pid).
** exception error: bad argument
     in function  register/2
        called as register(my_httpd,<0.48.0>)

...and yet, register works fine otherwise:

4> register(my_httpd, self()).
true

Is there something special about httpd processes that means that they
can't be registered?

Cheers,
Roger.



More information about the erlang-questions mailing list