transfer::connect(n) | Data transfer facilities | transfer::connect(n) |
transfer::connect - Connection setup
package require Tcl 8.4
package require snit ?1.0?
package require transfer::connect ?0.2?
transfer::connect objectName ?options...?
objectName method ?arg arg ...?
objectName destroy
objectName connect command
This package provides objects holding enough information to enable them to either actively connect to a counterpart, or to passively wait for a connection from said counterpart. I.e. any object created by this packages is always in one of two complementary modes, called active (the object initiates the connection) and passive (the object receives the connection).
Of the two objects in a connecting pair one has to be configured for active mode, and the other then has to be configured for passive mode. This establishes which of the two partners connects to whom (the active to the other), or, who is waiting on whom (the passive on the other). Note that this is completely independent of the direction of any data transmission using the connection after it has been established. An active object can, after establishing the connection, either transmit or receive data. Equivalently the passive object can do the same after the waiting for its partner has ended.
The object command will be created under the current namespace if the objectName is not fully qualified, and in the specified namespace otherwise. The fully qualified name of the object command is returned as the result of the command.
All objects created by the ::transfer::connect command have the following general form:
The detailed behaviour of the method depends on the configured mode.
This is necessary as the object might have been configured for port 0, allowing the operating system to choose the actual port it will listen on.
The listening port is closed immediately when the connection was established by the partner, to keep the time interval small within which a third party can connect to the port too. Even so it is recommended to use additional measures in the protocol outside of the connect and transfer object to ensure that a connection is not used with an unidentified/unauthorized partner One possibility for this is the use of SSL/TLS. See the option -socketcmd and section Secure connections for information on how to do this.
Connection objects support the set of options listed below.
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.
See also section 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::connect C -socketcmd tls::socket ... ...
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category transfer of the Tcllib SF Trackers [http://sourceforge.net/tracker/?group_id=12883]. Please also report any ideas for enhancements you may have for either package and/or documentation.
active, channel, connection, passive, secure, ssl, tls, transfer
Transfer module
Copyright (c) 2006-2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
0.2 | transfer |