Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
python_wiki:test_port [2015/03/09 23:27] billdozor |
python_wiki:test_port [2019/05/25 23:50] (current) |
||
---|---|---|---|
Line 10: | Line 10: | ||
---- | ---- | ||
- | ===== The Code ===== | + | ====== Usage ====== |
+ | |||
+ | Call this function, checking server1 for tcp/22 (ssh): | ||
+ | <code python> | ||
+ | if test_port(server1, | ||
+ | do ssh stuff | ||
+ | else: | ||
+ | print(" | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ====== The Code ====== | ||
<code python> | <code python> | ||
import socket | import socket | ||
Line 27: | Line 40: | ||
</ | </ | ||
- | ==== Usage ==== | + | ---- |
- | Call this function, checking server1 for tcp/22 (ssh): | + | |
- | <code python> | + | |
- | if test_port(server1, | + | |
- | do ssh stuff | + | |
- | else: | + | |
- | print(" | + | |
- | </ | + |