Created
April 15, 2016 23:03
-
-
Save kitsuyui/7f0d0c59f4d2db5738cb53d52d615043 to your computer and use it in GitHub Desktop.
nc -v -z すると 2 つ結果を返すのはなぜか? ref: http://qiita.com/kitsuyui/items/cbac88800dfe5cfb8dcb
This file contains hidden or 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
$ nc -v -z localhost 8000 | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused |
This file contains hidden or 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
$ nc -v -z localhost 8000 ; echo $? | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused | |
found 0 associations | |
found 1 connections: | |
1: flags=XX<CONNECTED,PREFERRED> | |
outif XXX | |
src 127.0.0.1 port XXXXX | |
dst 127.0.0.1 port 8000 | |
rank info not available | |
TCP aux info available | |
Connection to localhost port 8000 [tcp/irdmi] succeeded! | |
0 |
This file contains hidden or 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
$ nc -v -z 127.0.0.1 8000 | |
nc: connectx to 127.0.0.1 port 8000 (tcp) failed: Connection refused |
This file contains hidden or 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
$ nc -v -z ::1 8000 | |
nc: connectx to ::1 port 8000 (tcp) failed: Connection refused |
This file contains hidden or 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
$ man nc |
This file contains hidden or 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
$ nc -v -z -4 localhost 8000 | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused |
This file contains hidden or 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
$ nc -v -z -6 localhost 8000 | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused |
This file contains hidden or 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
$ /usr/local/bin/nc -v -z localhost 8000 | |
localhost [127.0.0.1] 8000 (irdmi): Connection refused |
This file contains hidden or 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
$ /usr/bin/nc -v -z -G 1 localhost 8000 | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused | |
nc: connectx to localhost port 8000 (tcp) failed: Connection refused | |
nc: connectx to localhost port 8000 (tcp) failed: Operation timed out | |
nc: connectx to localhost port 8000 (tcp) failed: Operation timed out | |
nc: connectx to localhost port 8000 (tcp) failed: Operation timed out |
This file contains hidden or 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
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
127.0.0.2 localhost | |
127.0.0.3 localhost | |
127.0.0.4 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment