about summary refs log tree commit diff
path: root/README
blob: b24f3c894b4c9d05d78ac8f7292f29b3683b0322 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
LISTENING(1)                General Commands Manual               LISTENING(1)

NAME
     listening – check if a TCP server is listening

SYNOPSIS
     listening [-46] [-t connect-timeout] [-w wait-timeout] [host] port

DESCRIPTION
     The listening utility performs a TCP scan against the given host
     (defaulting to localhost) and port.

     This can be used to detect if a slowly starting service is ready to
     accept connections.

     The options are as follows:

     -4      Force use of IPv4.

     -6      Force use of IPv6.

     -t connect-timeout
             Wait at most connect-timeout seconds per connection attempt
             (default: 0.2s, decimal fractions are allowed).

     -w wait-timeout
             Wait at most wait-timeout seconds total (decimal fractions are
             allowed), and keep trying to connecting when connection has been
             refused (default: only try once).

DETAILS
     listening implements a TCP SYN scan (half-open scan), which has several
     benefits:

     •   As the target program does not accept(2) the connection, there's no
         trace of testing.

     •   It's possible to do in unprivileged Linux userspace, thanks to
         TCP_QUICKACK and SO_LINGER (but also Linux specific).

     Note that firewalls may block this kind of scan, so for reliable results
     listening should be used on localhost only or within a DMZ.

EXIT STATUS
     listening returns one of the following status codes:

     0       when the port is up
     1       when the port refuses connection
     2       when timeout was reached
     99      if some other error occurred

SEE ALSO
     nc(1), nmap(1)

AUTHORS
     Leah Neukirchen <leah@vuxu.org>

LICENSE
     listening is in the public domain.

     To the extent possible under law, the creator of this work has waived all
     copyright and related or neighboring rights to this work.

     http://creativecommons.org/publicdomain/zero/1.0/

Void Linux                      August 8, 2023                      Void Linux