[Stuart Cassoff]'s "Communications Endpoints for [Tcl]" [http://www3.sympatico.ca/stuart.cassoff/index.html] gives, among other functionality, [UDP], [IPv6], ... What: ceptcl Where: http://www3.sympatico.ca/stuart.cassoff/software/index.html Description: Provides a variety of new socket types and greater control over socket options. Includes Domains : local (AF_UNIX), inet4 (IPV4), inet6 (IPV6) Types : tcp, udp, raw Options : boradcast, multicast, etc. ceptcl is designed to be backward compatible with existing Tcl socket apps. It is intended that all you need to do to use ceptcl is to require the package and change the invocation of 'socket' to 'cep'. Tested on OpenBSD, MacOSX, NetBSD, Linux. Currently at version 0.3 . Updated: 04/2005 Contact: See web site [["... significant demo of Tcl's extensibility (and Tcl_Channel's as well) ..."]] [[... only internal mucking is through ...]] [[... fully compatible with [socket], [tls], ...]] [[?Fit for folding back into [core]?]] ''(I think so --JE)'' "It has been designed so that [Windows] capability would be easy to integrate." As of May 2005, though, there's no Windows port. [PT] The most advanced socket extension for Windows is [iocpsock] [http://iocpsock.sourceforge.net/] which provides [IRDA] and [IPv6] sockets and significant performance improvements for normal sockets on this platform. It is probably best if these two extensions either get merged or are merged into the core together. [JE] ''(23 Nov 2005)'' The ceptcl source tarball has been missing in action for a while now -- the original author recently resurfaced on the chatroom looking for a copy! -- but there's a cached copy here: [http://www.flightlab.com/~joe/gutter/mirror/ceptcl-0.3.tar.gz] September 20 2006 - the referred link in the Where: is a useless dummy page now. ---- '''Using ceptcl to work with existing Unix-domain sockets''' set chan [cep -domain local /path/to/socket] And from there on it is just like working with normal Tcl sockets (except for the different [fconfigure] options, of course.) '''Logging to syslog(8) with ceptcl''' [PT] The syslog message format is ascii based and described in RFC3164 [http://www.faqs.org/rfcs/rfc3164.html]. We can construct messages quite simply and send them either via UDP or via Unix domain sockets using ceptcl. proc Log {facility priority tag message} { set PRI [expr {($facility * 8) + $priority}] set HDR [clock format [clock seconds] -format "%b %d %H:%M:%S"] append HDR " " [lindex [split [info host] .] 0] set socket [cep -domain local -type datagram /dev/log] fconfigure $socket -buffering none -translation {auto lf} puts -nonewline $socket "<${PRI}>$HDR $tag: $message" close $socket } e.g: Log 23 5 test "this is a test log message" which is facility local7 and severity notice. Handling the facility and severity names is left as an excercise to anyone that turns this into a package. ---- [[[Category Package]|[Category Internet]]]