Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
wiki:programming_languages:shell:shell-kernel-tcp_port_test [2016/08/05 21:51]
iggy.ttt@gmail.com
wiki:programming_languages:shell:shell-kernel-tcp_port_test [2016/08/05 21:54] (current)
iggy.ttt@gmail.com
Line 18: Line 18:
  
 <​code>​ <​code>​
-Linux kernel - Successful +Linux kernel ​  ​- Successful 
-Mac OS X - Successful +Mac OS X       ​- Successful 
-HP Unix – Without Success+HP Unix        – Without Success
 </​code>​ </​code>​
  
Line 28: Line 28:
 To test TCP connection to remote server it is possible to use Linux Kernel in this way: To test TCP connection to remote server it is possible to use Linux Kernel in this way:
  
-<​code>​IP=<​Destination_IP>​ ;                                                        # IP where to connect ​TCP_Port=<​Destination_TCP_Port>​ ;                                            # TCP port where to connect+<​code>​ 
 +IP=<​Destination_IP>​ ;                                                        # IP where to connect 
 +TCP_Port=<​Destination_TCP_Port>​ ;                                            # TCP port where to connect
  
-$(echo> /​dev/​tcp/​$IP/​$TCP_Port)>/​dev/​null 2>&​1 ​ && echo "​Successful connected"​ || echo "NOT Successful connected"​+$(echo> /​dev/​tcp/​$IP/​$TCP_Port)>/​dev/​null 2>&​1 ​ && echo "​Successful connected"​ || echo "NOT Successful connected"​
 </​code>​ </​code>​
 +
 ==== Example - Successful ==== ==== Example - Successful ====
  
-<​code>#​ IP="​127.0.0.1"​ ;                                                              # IP where to connect # TCP_Port="​22"​ ;                                                               # TCP port where to connect+<​code>​ 
 +# IP="​127.0.0.1"​ ;                                                              # IP where to connect 
 +# TCP_Port="​22"​ ;                                                               # TCP port where to connect
  
-# $(echo> /​dev/​tcp/​$IP/​$TCP_Port)>/​dev/​null 2>&​1 ​ && echo "​Successful connected"​ || echo "NOT Successful connected" ​ Successful connected ​                                                           # Result of the test+# $(echo> /​dev/​tcp/​$IP/​$TCP_Port)>/​dev/​null 2>&​1 ​ && echo "​Successful connected"​ || echo "NOT Successful connected"​ 
 + 
 +Successful connected ​                                                           # Result of the test
 </​code>​ </​code>​
 +
 ==== Example - Unsucessful ==== ==== Example - Unsucessful ====
  
-<​code>#​ IP="​127.0.0.1"​ ;                                                              # IP where to connect # TCP_Port="​2222"​ ;                                                             # TCP port where to connect+<​code>​ 
 +# IP="​127.0.0.1"​ ;                                                              # IP where to connect 
 +# TCP_Port="​2222"​ ;                                                             # TCP port where to connect 
 + 
 +# $(echo> /​dev/​tcp/​$IP/​$TCP_Port)>/​dev/​null 2>&​1 ​ && echo "​Successful connected"​ || echo "NOT Successful connected"​
  
-# $(echo> /​dev/​tcp/​$IP/​$TCP_Port)>/​dev/​null 2>&​1 ​ && echo "​Successful connected"​ || echo "NOT Successful connected"  ​-bash: connect: Connection refused ​                                             # If it's possible it will provide you the reason+-bash: connect: Connection refused ​                                             # If it's possible it will provide you the reason
 -bash: /​dev/​tcp/​127.0.0.1/​2222:​ Connection refused ​                             # Way it was not possible to connect -bash: /​dev/​tcp/​127.0.0.1/​2222:​ Connection refused ​                             # Way it was not possible to connect
 NOT Successful connected ​                                                       # Result of the test NOT Successful connected ​                                                       # Result of the test
 </​code>​ </​code>​
  
Navigation
Print/export
QR Code
QR Code wiki:programming_languages:shell:shell-kernel-tcp_port_test (generated for current page)