This manual page is for Mac OS X version 10.6.3

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

  • For more information about the manual page format, see the manual page for manpages(5).

  • For more information about this technology, look for other documentation in the Apple Reference Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.




transfer::connect(n)                      Data transfer facilities                      transfer::connect(n)



____________________________________________________________________________________________________________

NAME
       transfer::connect - Connection setup

SYNOPSIS
       package require Tcl  8.4

       package require snit  ?1.0?

       package require transfer::connect  ?0.1?

       transfer::connect object ?options...?

       object destroy

       object connect command

____________________________________________________________________________________________________________

DESCRIPTION
       This  package provides objects holding enough information to enable them to either connect to a coun-terpart, counterpart,
       terpart, or to be connected to by 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 node can, after establishing the connection, either transmit or  receive
       data. Equivalently the passive node can do the same after the waiting for it partner has ended.

API
       transfer::connect object ?options...?
              This  command  creates and configures a new connection object. The fully qualified name of the
              object command is returned as the result of the command.

              The recognized options are listed below.

              -mode mode
                     This option specifies the mode the object is in. It is optional and defaults to  active
                     mode. The two possible modes are:

                     active In  this  mode the two options -host and -port are 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 -host has no relevance and is ignored should it be con-figured. configured.
                            figured.  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
                     This option specifies the host to connect to in active mode,  either  by  name  or  ip-address. ipaddress.
                     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 is the port where the object creates the  listening  socket
                     waiting  for  a  connection. It defaults to 0, which allows the OS to choose the actual
                     port to listen on.

              -encoding encodingname

              -eofchar eofspec

              -translation transspec
                     These options are the same as are recognized by the builtin  command  fconfigure.  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 method connect).

       object destroy
              This method destroys the object.  This is safe to do for an active object  when  a  connection
              has  been  started, as the completion callback is synchronous.  For a passive object currently
              waiting for its parter to establish the connection however this is not  safe  and  will  cause
              errors  later on, when the connection setup completes and tries to access the now missing data
              structures of the destroyed object.

       object connect command
              This method starts the connection setup per the configuration of the object. When the  connec-tion connection
              tion  is  established  the  callback command will be invoked with one additional argument, the
              channel handle of the socket over which data can be transfered.

              The detailed behaviour of the method depends on the configured mode. For an active object  the
              connection  setup  is  done  synchronously.  I.e. the object will wait until the connection is
              established. In that mode the method returns the empty string as its result.

              A passive object however operates asynchronously. The method will return immediately  after  a
              listener  has  been  set  up and the connection will be established in the background. In that
              mode the method returns the port number of the listening socket, for use by the  caller,  like
              transfering this information to the counterpart so that it may know where to connect to.

              This  is  necessary  as  the  object might have been configured for port 0, allowing the OS 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.


BUGS, IDEAS, FEEDBACK
       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://source-
       forge.net/tracker/?group_id=12883].  Please also report any ideas for enhancements you may  have  for
       either package and/or documentation.

KEYWORDS
       active, channel, connection, passive, transfer

COPYRIGHT
       Copyright (c) 2006 Andreas Kupries <andreas_kupries@users.sourceforge.net>




transfer                                             0.1                                transfer::connect(n)

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.

Did this document help you? Yes It's good, but... Not helpful...