[erlang-questions] badarg when registering httpd process?

Fred Hebert mononcqc@REDACTED
Fri Jul 11 16:44:44 CEST 2014


On 07/11, Roger Lipscombe wrote:
> 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:
> 
> [snip]
> 
> Is there something special about httpd processes that means that they
> can't be registered?
> 

A process can't be registered twice:

1> application:ensure_all_started(inets).
{ok,[inets]}
2> {ok, Pid} = inets:start(httpd, [{port, 0}, {server_name,
2> "localhost"}, {server_root, "/tmp"}, {document_root, "/tmp"}]).
{ok,<0.67.0>}
3> process_info(Pid, registered_name).
{registered_name,httpd_instance_sup_54506}

It already has a name and therefore you can't register it a second time.

Regards,
Fred.



More information about the erlang-questions mailing list