Created
October 9, 2015 06:30
-
-
Save m0t0k1/d5d3c98c8327ef3c143e to your computer and use it in GitHub Desktop.
なでしこでnakonet.nakoを利用した簡易Webサーバー
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!「nakonet.nako」を取り込む | |
サーバーとはTCPサーバー | |
サーバーのポートは5678 | |
サーバーを開始 | |
サーバーで受信した時は~ | |
パスとは文字列 | |
レスポンスとは文字列 | |
ドキュメントルートとは文字列 | |
返却ファイルとは文字列 | |
ドキュメントルートは「C:\contents」 | |
サーバーの受信データを「 」で区切る | |
パスはそれ[1] | |
もしパスが「/」ならばパスは「/index.html」 | |
返却ファイルは「{ドキュメントルート}\{パス}」 | |
もし返却ファイルが存在ならば | |
返却ファイルを開く | |
レスポンスは「HTTP/1.0 200 OK{改行}Content-Type: text/html{改行}{改行}{それ}」 | |
違えば | |
レスポンスは「HTTP/1.0 404 File Not Found{改行}Content-Type: text/html{改行}{改行}ファイルが見つかりません」 | |
(サーバーの相手IP)へ(レスポンス)をサーバーで送信 | |
サーバーの送信完了した時は | |
サーバーの相手IPをサーバーが切断 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment