2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

telnetとncコマンドでクライアントとサーバ対話させたよ

Posted at

telnetはそのポート開いているか確認するときに便利だったりするよね

nc同士

サーバ側

[ec2-user@ip-10-0-2-248 ~]$ nc -l -p 12080
こんにちは
こんにちはクライアントさん #サーバ側で入力
こんにちはサーバさん #クライアント側で入力

クライアント側

[ec2-user@ip-10-0-2-231 ~]$ nc サーバのIP 12080
こんにちは
こんにちはクライアントさん
こんにちはサーバさん


Ncat: Connection timed out.
→firewallでブロックしてる(EC2ならセキュリティグループの設定確認)

ncとtelnet(クライアント)

サーバ側は同様

クライアント側

[ec2-user@ip-10-0-2-231 ~]$ telnet 3.115.5.128 12080
Trying 3.115.5.128...
Connected to 3.115.5.128.
Escape character is '^]'.
私はtelnetから接続しています #クライアント側で入力

サーバ側

[ec2-user@ip-10-0-2-248 ~]$ nc -l -p 12080
私はtelnetから接続しています

注意:telnet: connect to address サーバIP: Connection refused
ncで対話したときのセッションが残っているので、サーバ側のncコマンドを再度listenさせましょう

[ec2-user@ip-10-0-2-248 ~]$ nc -l -p 12080
こんにちは
こんにちはクライアントさん
こんにちはサーバさん
^C
[ec2-user@ip-10-0-2-248 ~]$ nc -l -p 12080

telnetコマンド
https://eng-entrance.com/linux-command-telnet

2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?