LoginSignup
1
0

More than 5 years have passed since last update.

nc -lk で受信値を垂れ流すだけのサーバ

Posted at

環境

  • Mac OS/X 10.7.5

使用目的

jMeterで作成するHTTPリクエストの内容確認がしたかったので。

コマンド

nc
#ポート 8000で待ち受ける
nc -lk 8000

TCPコネクションが切断されてもncが終了されないように -k を付与。
jMeter側はtimeoutを早めに設定しておく。

kobito.1381550484.500274.png

結果

出力イメージ
nc -lk 8000                                   
POST / HTTP/1.1
Connection: close
Content-Type: application/x-www-form-urlencoded
Content-Length: 99
User-Agent: Java/1.7.0_09
Host: localhost:8000
Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

<RequestBody>
  <element sequence="1">
     <timestamp></timestamp>
  </element>
</RequestBody>POST / HTTP/1.1
Connection: close

1
0
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
1
0