dnsjit.output.tcpcli(3)
π dnsjit.output.tcpcli β the manual page, but make it cute π
okay bestie, so you know how sometimes you just need a simple, length aware, TCP client and you don't want drama? that's literally this. it lives in dnsjit.output.tcpcli(3), in the Library Functions Manual, and it's giving "I handle your payloads so you don't have to" π
β¨ SYNOPSIS β¨
local output = require("dnsjit.output.tcpcli").new("127.0.0.1", "53")
like. one line. that's the whole vibe. slay. π
πΈ DESCRIPTION πΈ
so basically: it's a simple TCP client that takes any payload you hand it, sends the length of that payload as an unsigned 16 bit integer, and then sends the payload itself. length-first, content-second. she's organized like that. β¨
when receiving, she's gonna do the same thing but backwards: first she retrieves the length of the payload as an unsigned 16 bit integer, and she will stall until she gets it β even if nonblocking mode is on. no cap, she waits. periodt. π
then she retrieves at least that amount of bytes. and here's the tea:
- if nonblocking mode is used at this point, she'll return a payload object with length zero if there was nothing to receive, or if the full payload hasn't been received yet.
- additional calls will continue retrieving the payload. she picks up where she left off, main character energy. π
π¦ Attributes π¦
timeoutβ acore.timespecthat is used when producing objects. her little clock. β°
π§ Functions π§
Tcpcli.new()β create a newTcpclioutput. fresh out the box, brand new, iconic. π«ΆTcpcli:timeout(seconds, nanoseconds)β set the timeout when producing objects.Tcpcli:connect(host, port)β connect to the host and port, and return0if it worked. success!! πTcpcli:nonblocking(bool)β enable (true) or disable (false) nonblocking mode, and return0if it worked. and if bool isn't specified at all? then she just returns whether nonblocking mode is on (true) or off (false). a lil check-in, iykyk. πTcpcli:receive()β return the C functions and context for receiving objects. these objects will be sent.Tcpcli:produce()β return the C functions and context for producing objects. these objects are received. okay so here's the whole situation:- if nonblocking mode is enabled, the producer will return a payload object with length zero if there was nothing to receive, or if the full payload hasn't been received yet.
- if nonblocking mode is disabled, the producer will wait for data, and if it times out (see timeout) it will return a payload object with length zero.
- if a timeout happens during the first stage β getting the length β it will fail and return
nil. π - additional calls will continue retrieving the payload.
- and the producer returns
nilon error. that's the rule. π
Tcpcli:packets()β return the number of "packets" sent. and yes, the quotes are doing heavy lifting: it's actually the number of completely sent payloads. πTcpcli:received()β return the number of "packets" received. again, actually the number of completely received DNS messages. not me being pedantic, it's literally in the docs. πTcpcli:errors()β return the number of errors when sending. we don't talk about those. π
π AUTHORS and CONTRIBUTORS π
the legends themselves:
- Jerry LundstrΓΆm (DNS-OARC)
- TomΓ‘Ε‘ KΕΓΕΎek (CZ.NIC)
- Petr Ε paΔek (ISC)
maintained by DNS-OARC
https://www.dns-oarc.net/
π BUGS π
got issues? got feature requests? bestie, take it here:
https://codeberg.org/DNS-OARC/dnsjit/issues
got questions? need help? hit up:
admin@dns-oarc.net
don't be shy, they're nice. fr fr. π
and that's the whole page, babe π this was dnsjit version 1.5.1, documented as dnsjit.output.tcpcli(3) β go forth and send some length-prefixed payloads, you absolute icon. β π¦ π
π¦ where this page comes from
- epel 10: dnsjit 1.5.1-2.el10_2 Β· GPL-3.0-or-later
- epel 9: dnsjit 1.5.1-2.el9 Β· GPL-3.0-or-later
- fedora 43: dnsjit 1.5.1-2.fc43 Β· GPL-3.0-or-later
- fedora 43: dnsjit 1.5.1-2.fc43 Β· GPL-3.0-or-later
- fedora 44: dnsjit 1.5.1-2.fc44 Β· GPL-3.0-or-later
- fedora 44: dnsjit 1.5.1-2.fc44 Β· GPL-3.0-or-later
- ubuntu resolute: dnsjit 1.5.1-2 Β· GPL-3.0-or-later
- ubuntu stonking: dnsjit-dev 1.5.1-6 Β· GPL-3.0-or-later
- Copyright (c) 2018-2026 OARC, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms