openlang

inets 서버를 어떻게 중지하나요?

안녕하세요,

inets에 관해 아주 기본적인 질문이 있어요(추가 의존성이 필요 없어서 상당히 편하더군요). 시작한 inets “서비스”는 어떻게 종료하나요(예를 들어 버전 28.4에서요)?

아래 시도는 성공하지 못했어요:


Eshell V16.3 (press Ctrl+G to abort, type help(). for help)

(demo@nodebox)1> inets:start().
ok
(demo@nodebox)2> {ok,ServerPid} = inets:start( httpd,[{profile,cedar}, {port,8080}, {server_name,"maple"}, {server_root,"."}, {document_root,"."}, {bind_address,"127.0.0.1"}]).
{ok,<0.115.0>}
(demo@nodebox)3> inets:stop( httpd, ServerPid).
{error,not_found}
(demo@nodebox)4> inets:stop( httpd, cedar).
** exception error: no function clause matching httpd:stop_service(cedar) (httpd.erl:1278)
	 in function  inets:call_service/3 (inets.erl:558)
(demo@nodebox)5> inets:stop( httpd, "maple").
** exception error: no function clause matching httpd:stop_service("maple") (httpd.erl:1278)
	 in function  inets:call_service/3 (inets.erl:558)
(demo@nodebox)7> inets:services().
[{httpc,<0.111.0>},{httpd,<0.115.0>}]
(demo@nodebox)8> ServerPid.
<0.115.0>
(demo@nodebox)9> inets:services_info().
[{httpc,<0.111.0>,[{profile,default}]},
 {httpd,<0.115.0>,
		[{bind_address,{127,0,0,1}},
		 {host,"nodebox"},
		 {port,8080},
		 {server_name,"maple"}]}]

위의 httpd 항목에 무슨 이유로 {profile,cedar}가 빠져 있는 걸까요?

조언 부탁드려요, 감사합니다!

Tavin.

영어에서 번역원문 보기

이어지는 대화 2

서로의 근거를 따라
  1. 고유 링크

    안녕하세요,

    프로필을 지정해서 시작한 httpd 서비스를 종료할 때는 inets:stop(httpd, {BindAddress, Port, Profile})을 호출해요

    프로필 없이 시작했다면 inets:stop(httpd, {BindAddress, Port})나 inets:stop(httpd, ServerPid)를 쓸 수 있어요

    inets:services_info()에도 프로필 이름이 나와야 할 것 같은데, 빠진 이유가 있는지 살펴봐야겠어요.

    안부를 전하며,

    Mervin

    영어에서 번역원문 보기
  2. 고유 링크

    정말 고마워요 Mervin, inets:stop(httpd, {{127,0,0,1}, 8080, cedar})가 딱 원하던 대로 동작하네요!

    inets — inets v9.6.2 (https://www.erlang.org/doc/apps/inets/inets.html#stop/2)에서 “Reference :: pid (https://www.erlang.org/doc/apps/erts/erlang.html#t:pid/0)() | term (https://www.erlang.org/doc/apps/erts/erlang.html#t:term/0)()” 타입을 더 잘 설명하고, 서버의 관련 정보는 대부분 httpd — inets v9.6.2 (https://www.erlang.org/doc/apps/inets/httpd.html)에 있다는 점을 강조해 주면 좋겠어요(클라이언트도 마찬가지로 httpc — inets v9.6.2 (https://www.erlang.org/doc/apps/inets/httpc.html)에 있고요).

    다시 한번 감사해요!

    영어에서 번역원문 보기

같은 질문의 다른 갈래

  1. Raspberry Pi 4에서 파일 열기

    Raspberry Pi 4에서 특정 디렉터리의 파일 1200개 이상을 읽으려고 for 루프 안에서 fopen을 씁니다. 루프가 어느 정도 반복되면 fopen으로 다음 파일을 읽을 수 없게 됩니다. 어떻게 해결해야 할까요?

    답글 2최근 활동 c
  2. Go가 SIGUSR1과 SIGUSR2를 예약하나요?

    개발자 여러분, go 애플리케이션을 dmtcp 아래서 실행하려고 합니다 (GitHub의 dmtcp/dmtcp는 분산 멀티스레드 체크포인트 프로젝트 DMTCP입니다 (https://github.com/dmtcp/dmtcp)).…

    답글 2최근 활동 go