What: ceptcl 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.4 . Updated: 11/2008 Contact: See web siteDocumentation is included in the .tar.gz download, but is currently (2007-12-30) missing from the web site. It can however be found at [1] (in the GUTTER).["... significant demo of Tcl's extensibility (and Tcl_Channel's as well) ..."][... only internal mucking is through <tcl.h> ...][... 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 [2] 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.September 20 2006 - the referred link in the Where: is a useless dummy page now.Stu 2006/10/16 - New page is up!
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 ceptclPT The syslog message format is ascii based and described in RFC3164 [3]. 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.
[ Does ceptcl support SCTP? ]Stu No, unless unintentionally.
Ceptcl 0.4 edit
Stu 2008-11-28 Ceptcl 0.4 is released.New for Ceptcl 0.4: * Major cleanup. * Bug removal. * Local names handled properly. * New/changed fconfigure options. * New [resolve] command for all your name resolution needs. * Better datagramming Use [cepPuts] and [cepRead] for proper workingness. Commands puts, gets and read can still be used and mixing them with the cep versions works somewhat, I think - but you really shouldn't be doing that. * New [cepPassChannel] command allows passing Tcl channels over local ceps to other processes. * Practically no new documentation whatsoever! Check out some of the example scripts. * 8.5 enforced. * Newer TEA. * It should all or mostly work. * Plan is to have a cleaned-up, documented version 0.5 in early 2009.
[Mash] [02/07/2016] aaah! frustrations!! Does this work on latest linux version? I downloaded 0.4 and it fails to compile with lot of gcc errors/warnings. Is this still in active development? If not, can anyone suggest a way to send raw IP packets on TCl 8.5 (not udp.tcp, just IP using raw sockets).