Ping¶
netutils.ping
¶
Functions to create a ping via pure Python.
tcp_ping(ip, port, timeout=1)
¶
Verifies whether a TCP port is open on a given IP address.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ip |
str
|
An IP address in string format that is able to be converted by |
required |
port |
int
|
A valid TCP port. |
required |
timeout |
int
|
The timeout in seconds before returning a False. Defaults to 1. |
1
|
Returns:
Type | Description |
---|---|
bool
|
The result as to whether or not you were able ping the IP address. |
Examples:
>>> from netutils.ping import tcp_ping
>>> tcp_ping("1.1.1.1", 443)
True
>>> tcp_ping("1.0.100.0", 27)
False
>>>