tcpserver(1)
π tcpserver(1) β the General Commands Manual glow-up π
okay bestie, sit down, hydrate, and let me tell you about tcpserver from the General Commands Manual. this is the icon that accepts incoming TCP connections, and it's genuinely the moment. π
β¨ NAME β¨
tcpserver β accepts incoming TCP connections. no cap, that's the whole job and it does it flawlessly. π
πΈ SYNOPSIS πΈ
tcpserver [ opts ] host port prog
π¦ DESCRIPTION π¦
so here's the vibe. opts is a series of getopt-style options. host is one argument. port is one argument. prog consists of one or more arguments.
tcpserver waits for connections from TCP clients. For each connection, it runs prog, with descriptor 0 reading from the network and descriptor 1 writing to the network. It also sets up several environment variables. it's giving main character energy fr fr. π
The server's address is given by host and port. port may be a name from /etc/services or a number; if it is 0, tcpserver will choose a free TCP port. host may be 0, allowing connections to any local IP address; or a dotted-decimal IP address, allowing connections only to that address; or a host name, allowing connections to the first IP address for that host. Host names are fed through qualification using dns_ip4_qualify. obsessed with the flexibility ngl. π
β¨ heads up bestie:tcpserverexits when it receivesSIGTERM. that's the goodbye signal and it respects it immediately. π
π OPTIONS π
π«Ά General options:
-qβ Quiet. Do not print error messages. shhh era. π€«-Qβ (Default.) Print error messages. the default is talkative, love that for us.-vβ Verbose. Print error messages and status messages. full commentary mode, we love a yapper. π£οΈ
π₯ Connection options:
-cn β Do not handle more than n simultaneous connections. If there are n simultaneous copies ofprogrunning, defer acceptance of a new connection until one copy finishes. n must be a positive integer. Default:40. it's giving bouncer at the club, capacity is capacity. π-xcdb β Follow the rules compiled into cdb bytcprules(1). These rules may specify setting environment variables or rejecting connections from bad sources. You can reruntcprules(1)to change the rules whiletcpserveris running. live edits, iconic behavior. β¨-Xβ With-xcdb, allow connections even if cdb does not exist. Normallytcpserverwill drop the connection if cdb does not exist. the default is strict, this is the chill pass. π-Bbanner β Write banner to the network immediately after each connection is made.tcpserverwrites banner before looking up$TCPREMOTEHOST, before looking up$TCPREMOTEINFO, and before checking cdb. This feature can be used to reduce latency in protocols where the client waits for a greeting from the server. first impression speedrun. πβοΈ-ggid β Switch group ID to gid after preparing to receive connections. gid must be a positive integer.-uuid β Switch user ID to uid after preparing to receive connections. uid must be a positive integer. dropping privileges is the self-care we deserve. π§βοΈ-Uβ Same as-g $GID -u $UID. Typically$GIDand$UIDare set byenvuidgid(8).-1β After preparing to receive connections, print the local port number to standard output. perfect if you let the system pick the port and now you gotta know which one. π-bn β Allow a backlog of approximately n TCP SYNs. On some systems, n is silently limited to5. On systems supporting SYN cookies, the backlog is irrelevant. no cap, sometimes the system just says no.-oβ Leave IP options alone. If the client is sending packets along an IP source route, send packets back along the same route.-Oβ (Default.) Kill IP options. A client can still use source routing to connect and to send data, but packets will be sent back along the default route. the default is the "no detours" policy. π«-dβ Delay sending data for a fraction of a second whenever the remote host is responding slowly. This is currently the default, but it may not be in the future; if you want it, set it explicitly. β οΈ say it with me: do not rely on future defaults, set it explicitly bestie.-Dβ Never delay sending data; enableTCP_NODELAY. zero patience, maximum speed. π₯
π Data-gathering options:
-hβ (Default.) Look up the remote host name in DNS to set the environment variable$TCPREMOTEHOST.-Hβ Do not look up the remote host name in DNS; remove the environment variable$TCPREMOTEHOST. To avoid loops, you must use this option for servers on TCP port53. π¨ mandatory, not a suggestion.-pβ Paranoid. After looking up the remote host name in DNS, look up the IP addresses in DNS for that host name, and remove the environment variable$TCPREMOTEHOSTif none of the addresses match the client's IP address. trust issues: valid. π΅οΈβοΈ-Pβ (Default.) Not paranoid. trusting era. π«Ά-llocalname β Do not look up the local host name in DNS; use localname for the environment variable$TCPLOCALHOST. A common choice for localname is0. To avoid loops, you must use this option for servers on TCP port53. π¨ also mandatory, also not a suggestion.-rβ (Default.) Attempt to obtain$TCPREMOTEINFOfrom the remote host.-Rβ Do not attempt to obtain$TCPREMOTEINFOfrom the remote host. To avoid loops, you must use this option for servers on TCP ports53and113. π¨ third time's the charm, loops are NOT the vibe.-tn β Give up on the$TCPREMOTEINFOconnection attempt after n seconds. Default:26. we wait, but we do not wait forever. β³
π SEE ALSO π
the whole friend group, periodt:
tcprules(1),tcprulescheck(1),argv0(1),fixcrio(1),recordio(1),rblsmtpd(1),tcpclient(1),who@(1),date@(1),finger@(1),http@(1),tcpcat(1),mconnect(1),tcp-environ(5)http://cr.yp.to/ucspi-tcp.html
okay that's the whole page, bestie, and we ate. π
β¨ this was the tcpserver(1) page straight out of the General Commands Manual β same title, same manual name, no extra dates or version numbers tacked on, just pure ucspi-tcp content. go forth and accept those connections. ππ¦πΈπ₯ππ
π¦ where this page comes from
- debian bookworm: ucspi-tcp 1:0.88-7 Β· LicenseRef-public-domain
- debian trixie: ucspi-tcp 1:0.88-13 Β· LicenseRef-public-domain
- nixos 26.05: ucspi-tcp 0.88
- nixpkgs unstable: ucspi-tcp 0.88
- ubuntu jammy: ucspi-tcp 1:0.88-6 Β· LicenseRef-public-domain
- ubuntu noble: ucspi-tcp 1:0.88-8ubuntu1 Β· LicenseRef-public-domain
- ubuntu resolute: ucspi-tcp 1:0.88-13ubuntu1 Β· LicenseRef-public-domain
- ubuntu stonking: ucspi-tcp 1:0.88-13ubuntu1 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms