LoginSignup
0
1

More than 5 years have passed since last update.

Erlangの勉強、始めます。

Last updated at Posted at 2016-12-29

おことわり!

人さまにお見せすることを主目的にはしておりません。
私が何かを忘却した未来の私のために残す書き置きです。

座学

Erlangのこと

twitterブームの陰で注目を集める“Erlang”

背景

  • Web2.0の先にあるC10K問題
  • メモリを共有するマルチスレッドプログラミングの複雑性は人間の脳の処理能力を超える
  • NコアでN倍のパフォーマンスが出ればそれで良い

Erlang

  • 各"ユーザスレッド"はメッセージをやり取りするアクターとして振る舞う

始める環境

  • Macbook Air(macOS Sierra 10.12.2)
  • kerl(build 19.2)

導入手順

こちらを参考にさせていただきました。

やったこと

仕様が変わったらしいこと

httpがない

インターネットに転がっているサンプルを見よう見まねで実行するとうまく行かなかった。

1> inets:start().
ok
2> http:request("http://www.google.co.jp/"). 
** exception error: undefined function http:request/1

えっ。。。
これで時間を食いました。とりあえず諦めて次のサンプルをコンパイルしたところ…

cohttp.erl
(前略)
〜〜〜http:request(Url),
(後略)
1> c(cohttp).
cohttp.erl:9: Warning: call to http:request/1 will fail, since it was removed in R15B; use httpc:request/1

(あっ)

1> inets:start().
ok
2> httpc:request("http://www.google.co.jp"). 
{ok,{{"HTTP/1.1",200,"OK"},
     [{"cache-control","private, max-age=0"},
      {"date","Thu, 29 Dec 2016 08:55:34 GMT"},
      {"accept-ranges","none"},
      {"server","gws"},
      {"vary","Accept-Encoding"},
      {"content-length","47048"},
      {"content-type","text/html; charset=Shift_JIS"},
      {"expires","-1"},
      {"p3p",
       "CP=\"This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info.\""},
      {"x-xss-protection","1; mode=block"},
      {"x-frame-options","SAMEORIGIN"},
      {"set-cookie",
       "NID=93=UiOepo6RoWcDubfvyc_WRQVgry0qetWS11_GyEk9oaGvT-cWW-tiEZMbCKzXhEB4N0oHS4n2OwyE8pSOUS6LnWTH02sQO6WVVQglMDd3GvWZsrp0cO3fAQ_n3unWAOby; expires=Fri, 30-Jun-2017 08:55:34 GMT; path=/; domain=.google.co.jp; HttpOnly"}],
     [60,33,100,111,99,116,121,112,101,32,104,116,109,108,62,60,
      104,116,109,108,32,105,116,101|...]}}

はい(^ω^ )気をつけますー

ご参考:Erlang -- HTTP Client

これから読む(TODO)

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1