transfer::transmitter(n)
π transfer::transmitter β the transfer::transmitter(n) manual page π
okay bestie, sit DOWN, because this is the Data transfer facilities page for transfer::transmitter(n) and it's a whole vibe β¨
πΈ NAME πΈ
transfer::transmitter β Data source π
β¨ SYNOPSIS β¨
package require Tcl 8.5 9
package require snit ?1.0?
package require transfer::copy ?0.3?
package require transfer::data::source ?0.3?
package require transfer::connect ?0.3?
package require transfer::transmitter ?0.3?
transfer::transmitter objectName ?options...?
transfer::transmitter stream channel chan host port ?arg...?
transfer::transmitter stream file path host port ?arg...?
objectName method ?arg arg ...?
objectName destroy
objectName start
objectName busy
π¦ DESCRIPTION π¦
so this package is literally the matchmaker of the transfer world π β it takes data sources and connection setup and pulls them together into one combined object so you can send information over a socket. no cap.
and the iconic part? These objects understand all the options from objects created by the packages transfer::data::source and transfer::connect. all of them. every single one. periodt. π
π API π
π PACKAGE COMMANDS π
transfer::transmitter objectName ?options...?β this command creates a brand-new transmitter object with an associated Tcl command whose name isobjectName. that object command is explained in full detail in the sections Object command and Object methods, and the set of supported options lives in Options. π«Ά
the object command gets created under the current namespace if objectName isn't fully qualified, and in the specified namespace otherwise. and what do you get back? the fully qualified name of the object command, returned as the result of the command. slay.
transfer::transmitter stream channel chan host port ?arg...?β this method makes a fire-and-forget transfer for the data sitting in the channelchan, starting at the current seek location. the channel gets configured to use binary translation and encoding for the transfer, and the channel is automatically closed once the transfer completes. no take-backs. π
if you hand it both host and port, it makes an active connection to the destination. but if only a port is specified β with host being the empty string β then it makes a passive connection instead. the way it switches like that? iconic.
anything you pass after the port is treated as options and used to configure the internal transmitter object. check Options for the list of supported options and what they mean. but heads up bestie β οΈ: the signature of the command prefix you give for the -command callback is different from the signature for that same option on the transmitter object. this callback only gets the number of bytes and transfered, and possibly an error message. no reference to the internally used transmitter object is made. π
the result returned by the command is the empty string if it was set up to make an active connection, and otherwise the port the internal transmitter object is listening on β i.e. when it's configured to connect passively. see also the package transfer::connect and the description of the method connect for where this behaviour comes from. πΈ
transfer::transmitter stream file path host port ?arg...?β this one is just likestream channel, except the data contained in the filepathis what gets transfered. same energy, different source. π
π§ OBJECT COMMAND π§
all objects created by the ::transfer::transmitter command have the following general form:
objectName method ?arg arg ...?β the methodmethodand its arg'uments determine the exact behavior of the command. see the section Object methods for the detailed specifications. iykyk. β
π OBJECT METHODS π
objectName destroyβ this method destroys the object. β οΈ and bestie, listen: doing so while a transmission is in progress will cause errors later on, when the transmission completes and tries to access the now missing data structures of the destroyed object. it's giving chaos. don't do it. πobjectName startβ this method kicks off the data transmission, setting up the connection first and then copying the information. it will throw an error if a transmission is already/still in progress β i.e. you literally cannot run two transmissions in parallel on a single object, only in sequence. need parallel transfers? you need multiple transmitter objects, one per transmission. no shortcuts. π
errors also get thrown if the configuration of the data source is invalid, or if no completion callback was specified. so set that callback, bestie. π«Ά
the result returned by the method is the empty string for an object configured to make an active connection, and otherwise the port the object is listening on β i.e. when it's configured to connect passively. see also the package transfer::connect and the description of the method connect for where this behaviour comes from. β¨
objectName busyβ this method returns a boolean value telling us whether a transmission is in progress (True), or not (False). a little vibe check for your transfer. π
π OPTIONS π
all transmitter objects support the union of the options supported by their connect and data source components, plus two of their own. see also the documentation for the packages transfer::data::source and transfer::connect. π
-blocksize intβ specifies the size of the chunks to be transmitted in one block. usage is optional, and its default value is1024. π§±-command cmdprefixβ specifies the command to invoke when the transmission of the information has been completed. the arguments given to this command are the same as those given to the completion callback of the commandtransfer::copy::doprovided by the packagetransfer::copy. π£-mode modeβ specifies the mode the object is in. optional, and defaults toactivemode. the two possible modes are:activeβ in this mode the two options-hostand-portare relevant and specify the host and TCP port the object has to connect to. the host is given by either name or IP address. πpassiveβ in this mode the option-hosthas no relevance and is ignored should it be configured. the only option the object needs is-port, and it specifies the TCP port on which the listening socket is opened to await the connection from the partner. π
-host hostname-or-ipaddrβ specifies the host to connect to in active mode, either by name or ip-address. an object configured for passive mode ignores this option. π-port intβ for active mode this option specifies the port the object is expected to connect to. for passive mode however, it's the port where the object creates the listening socket waiting for a connection. it defaults to0, which allows the OS to choose the actual port to listen on. π―-socketcmd commandβ lets you specify which command to use to open a socket. the default is to use the builtin::socket. anything compatible with that command is allowed. π
the envisioned main use is the specfication of tls::socket. i.e. this option allows the creation of secure transfer channels, without making this package explicitly dependent on the tls package. love that for us. π
see also the section Secure connections.
-encoding encodingname-eofchar eofspec-translation transspecβ these options are the same as are recognized by the builtin commandfconfigure. they provide the configuration to be set for the channel between the two partners after it has been established, but before the callback is invoked (see methodconnect). β¨-string textβ specifies that the source of the data is an immediate string, and its associated argument contains the string in question. π-channel handleβ specifies that the source of the data is a channel, and its associated argument is the handle of the channel containing the data. π‘-file pathβ specifies that the source of the data is a file, and its associated argument is the path of the file containing the data. π-variable varnameβ specifies that the source of the data is a string stored in a variable, and its associated argument contains the name of the variable in question. the variable is assumed to be global or namespaced, anchored at the global namespace. π«-size intβ specifies the size of the data transfer. optional, and defaults to-1. this value, and any other value less than zero, signals to transfer all the data from the source. π-progress commandβ if specified, defines a command to be invoked for each chunk of bytes transmitted, letting you monitor the progress of the transmission of the data. the callback is always invoked with one additional argument: the number of bytes transmitted so far. π
π SECURE CONNECTIONS π
one way to secure connections made by objects of this package is to require the package tls and then configure the option -socketcmd to force the use of command tls::socket to open the socket. π‘οΈ
# Load and initialize tls
package require tls
tls::init -cafile /path/to/ca/cert -keyfile ...
# Create a connector with secure socket setup,
transfer::transmitter T -socketcmd tls::socket ...
...
π TLS SECURITY CONSIDERATIONS π
Okay bestie, so this package uses the TLS package to handle the security for https urls and other socket connections. Slay.
But real talk: policy decisions like the set of protocols to support and what ciphers to use are not the responsibility of TLS, nor of this package itself. Nope. Those decisions belong to whichever application is using the package, and they're likely influenced by the set of servers the application will talk to as well. It's giving "your app, your rules" π .
For example? In light of the recent POODLE attack [http://googleonlinesecurity.blogspot.co.uk/2014/10/this-poodle-bites-exploiting-ssl-30.html] discovered by Google, many servers will disable support for the SSLv3 protocol. To handle this change, the applications using TLS must be patched β and not this package, nor TLS itself. Such a patch may be as simple as generally activating tls1 support, as shown in the example below:
package require tls
tls::init -tls1 1 ;# forcibly activate support for the TLS1 protocol
... your own application code ...
π BUGS, IDEAS, FEEDBACK π
Okay so this document, and the package it describes, will undoubtedly contain bugs and other problems. No cap. Please report such in the category transfer of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation. We're listening, bestie π«Ά.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar. (iykyk)
π KEYWORDS π
channel, copy, data source, secure, ssl, tls, transfer, transmitter
ποΈ CATEGORY ποΈ
Transfer module
Β©οΈ COPYRIGHT Β©οΈ
Copyright (c) 2006-2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
And that's the whole vibe, bestie! The footer says this is from tcllib, version 0.3, page transfer::transmitter(n) β iconic, no notes. πβ¨
π¦ where this page comes from
- fedora 43: tcllib 2.0-3.fc43 Β· TCL
- fedora 44: tcllib 2.0-4.fc44 Β· TCL
- nixos 26.05: tcllib 2.0
- nixpkgs unstable: tcllib 2.0
- Copyright (c) 2006-2009 Andreas Kupries <andreas_kupries@users\&.sourceforge\&.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms