Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Changes
Page history
Update debugging
authored
Nov 20, 2023
by
umaumax
Show whitespace changes
Inline
Side-by-side
debugging.md
View page @
bc585e56
...
@@ -177,8 +177,56 @@ g++ "$@" -g3 -O0
...
@@ -177,8 +177,56 @@ g++ "$@" -g3 -O0
オプションを強制的に追加することもできる
オプションを強制的に追加することもできる
## サーバアクセスのデバッグ
## ネットワーク
### サーバからの応答がなく、永久待機状態となった
### TCP通信の中身を気軽に確認したい
詳しく確認するにはtcpdumpコマンドがあるが、そこまでする必要がない場合
curlのリクエストとpythonファイルサーバからのレスポンスを確認することができる
```
bash
# temirnal A
python3
-m
http.server 8080
# terminal B
socat
-v
TCP4-LISTEN:18080,fork TCP4:localhost:8080
# terminal C
curl localhost:18080
```
```
bash
$
socat
-v
TCP4-LISTEN:18080,fork TCP4:localhost:8080
>
2023/11/20 13:16:34.640853
length
=
78
from
=
0
to
=
77
GET / HTTP/1.1
\r
Host: localhost:18080
\r
User-Agent: curl/8.1.2
\r
Accept:
*
/
*
\r
\r
< 2023/11/20 13:16:34.643186
length
=
155
from
=
0
to
=
154
HTTP/1.0 200 OK
\r
Server: SimpleHTTP/0.6 Python/3.9.12
\r
Date: Mon, 20 Nov 2023 04:16:34 GMT
\r
Content-type: text/html
;
charset
=
utf-8
\r
Content-Length: 297
\r
\r
< 2023/11/20 13:16:34.643715
length
=
297
from
=
155
to
=
451
<
!
DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"
>
<html>
<
head
>
<meta http-equiv
=
"Content-Type"
content
=
"text/html; charset=utf-8"
>
<title>Directory listing
for
/</title>
</head>
<body>
<h1>Directory listing
for
/</h1>
<hr>
<ul>
</ul>
<hr>
</body>
</html>
```
### サーバアクセスのデバッグ
#### サーバからの応答がなく、永久待機状態となった
1.
サーバの起動
1.
サーバの起動
2.
(この時点で、ポートへのアクセスを受け付け始める)
2.
(この時点で、ポートへのアクセスを受け付け始める)
3.
特定のパス(e.g.
`/health`
)の待受が完了する
3.
特定のパス(e.g.
`/health`
)の待受が完了する
...
...
...
...