diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b448606..49feef3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ The latest `## [X.Y.Z]` header must match the `version` field in `punkproject.to Entries are newest-first; one bullet per notable change. See the root `AGENTS.md` "Project Versioning" section for the bump policy. +## [0.4.3] - 2026-07-08 + +- vendored tcludp upgraded 1.0.12 -> 1.0.13 in the tcl9 kit vfs folders (punk9win.vfs, punk9win_for_tkruntime.vfs) and src/vendorlib_tcl9 — 1.0.12's Windows per-thread exit handler closed the process-global tcludp synchronization events, so the first udp-loaded worker thread to die froze every other udp-loaded thread's event loop (root cause of the G-036 wedge; fixed upstream in 1.0.13). Verified with the G-036 regression harness: run-2 syslog workers alive (baseline on 1.0.12: wedged 4/4). Note: punk8win.vfs still bundles udp 1.0.12 (8.6 appeared immune; pending decision). The manual vfs copy was required because `libs`/`vfscommonupdate`/`project` do not propagate vendorlib_tcl platform libraries into kit vfs lib_tcl trees — gap recorded as goal G-037. + +## [0.4.2] - 2026-07-08 + +- piped-stdin exit/quit hang fixed (shellthread 1.6.3, shellfilter 0.2.4): repl/app teardown no longer blocks forever when a shellthread worker's event loop has wedged — unsubscribe's settings-reset send is now async, shutdown_free_threads keeps its timeout armed across all waits, and shellfilter::run honors its -syslog option (default empty -> no runtag log worker thread) instead of a hardcoded 127.0.0.1:514 debug leftover. Syslog remains supported when explicitly configured. Diagnosis and residual root-cause work tracked as goal G-036. + ## [0.4.1] - 2026-07-07 - `script` subcommand now matches `tclsh` for GUI scripts: if the script leaves a registered Tk main loop (Tk loaded with a live main window), the event loop is serviced until the last window closes, instead of sourcing-then-exiting immediately. So a Tk script with no explicit `exit` (or one that exits from an `after` callback, like `scriptlib/tktimer.tcl`) stays alive and runs — previously it flashed and died, and `shell` was needed as a workaround (relevant to G-020 GUI automation). Console scripts are unaffected; a script that errors exits at once (no hanging window). Verified on both generations. diff --git a/goals/G-036-tcl9-udp-console-worker-wedge.md b/goals/G-036-tcl9-udp-console-worker-wedge.md index 66c15d1a..223c6798 100644 --- a/goals/G-036-tcl9-udp-console-worker-wedge.md +++ b/goals/G-036-tcl9-udp-console-worker-wedge.md @@ -259,6 +259,16 @@ handler: closes the events). No upstream report needed for the killer bug. = 1.0.12). Re-verify with the in-context batch harness after the upgrade (baseline: punk902z run-2 syslog workers wedged 4/4 -> expect 4/4 alive). +**Upgrade DONE and VERIFIED 2026-07-08 (project 0.4.3)**: tcludp 1.0.13 placed in +src/vendorlib_tcl9/win32-x86_64 and copied manually into punk9win.vfs/lib_tcl9 and +punk9win_for_tkruntime.vfs/lib_tcl9 (udp1.0.12 removed); rebuilt kit reports +`package require udp` = 1.0.13; regression batch (hidden-console, syslog force-toggled, +same conditions as the wedged baseline): run-2 syslog workers ALL ALIVE across runs. The +manual vfs copy was needed because make.tcl libs/vfscommonupdate/project do not propagate +vendorlib_tcl platform libs into kit vfs lib_tcl trees - gap recorded as goal G-037. +punk8win.vfs (8.6) still bundles udp 1.0.12 - same buggy code, immunity unexplained +(pending decision whether to swap in 1.0.13's udp1013t.dll for the 8.x kit too). + Loose ends / optional follow-ups: - Check which tcludp the punksys (8.6) kit bundles and why 8.6 appeared immune (different udp version, different exit-handler ordering, or fast-fail luck). diff --git a/punkproject.toml b/punkproject.toml index 349f36e7..0f2795e1 100644 --- a/punkproject.toml +++ b/punkproject.toml @@ -1,3 +1,3 @@ [project] name = "punkshell" -version = "0.4.2" +version = "0.4.3" diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/broadcast.tcl b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/broadcast.tcl similarity index 96% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/broadcast.tcl rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/broadcast.tcl index a5badc5a..e4c1bfbc 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/broadcast.tcl +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/broadcast.tcl @@ -1,39 +1,39 @@ -#!/usr/bin/env tclsh -# multicast.tcl - Copyright (C) 2004 Pat Thoyts -# -# Demonstrate the use of broadcast UDP sockets. -# -# You can send to ths using netcat: -# echo HELLO | nc -u 192.168.255.255 7772 -# -# $Id: broadcast.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ - -package require udp 1.0.6 - -proc udpEvent {chan} { - set data [read $chan] - set peer [fconfigure $chan -peer] - puts "$peer [string length $data] '$data'" - if {[string match "QUIT*" $data]} { - close $chan - set ::forever 1 - } - return -} - -# Select a subnet and the port number. -set subnet 192.168.255.255 -set port 7772 - -# Create a listening socket and configure for sending too. -set s [udp_open $port] -fconfigure $s -buffering none -blocking 0 -fconfigure $s -broadcast 1 -remote [list $subnet $port] -fileevent $s readable [list udpEvent $s] - -# Announce our presence and run -puts -nonewline $s "hello, world" -set forever 0 -vwait ::forever - -exit +#!/usr/bin/env tclsh +# multicast.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demonstrate the use of broadcast UDP sockets. +# +# You can send to ths using netcat: +# echo HELLO | nc -u 192.168.255.255 7772 +# +# $Id: broadcast.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ + +package require udp 1.0.6 + +proc udpEvent {chan} { + set data [read $chan] + set peer [fconfigure $chan -peer] + puts "$peer [string length $data] '$data'" + if {[string match "QUIT*" $data]} { + close $chan + set ::forever 1 + } + return +} + +# Select a subnet and the port number. +set subnet 192.168.255.255 +set port 7772 + +# Create a listening socket and configure for sending too. +set s [udp_open $port] +fconfigure $s -buffering none -blocking 0 +fconfigure $s -broadcast 1 -remote [list $subnet $port] +fileevent $s readable [list udpEvent $s] + +# Announce our presence and run +puts -nonewline $s "hello, world" +set forever 0 +vwait ::forever + +exit diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/bug1158628.tcl b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/bug1158628.tcl similarity index 96% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/bug1158628.tcl rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/bug1158628.tcl index e32a2ed7..be3c2c5f 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/bug1158628.tcl +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/bug1158628.tcl @@ -1,56 +1,56 @@ -#!/usr/bin/env tclsh -# bug1158628.tcl - Copyright (C) 2005 Pat Thoyts -# -# "On windows XP, I have a GUI that has an exit buttons which when -# pressed does: {set done 1; destroy .;exit} If there is an open UDP -# channel with a fileevent on it, the program will not exit -- -# i.e. task manager still shows it. Also if I have the console up, the -# console goes away when the exit button is invoked, but the program -# does not exit. NOTE -- all windows are correctly destroyed (or at -# least withdrawn)" -# -# The fault is calling Tcl_UnregisterChannel in the udpClose function. -# We must let tcl handle this itself. Solved by Reinhard Max. -# -# This script demonstrates the problem. Using udp 1.0.6 the program hangs -# after printing "Exiting...". With the fix applied it properly exits. -# -# $Id: bug1158628.tcl,v 1.2 2005/05/19 20:46:23 patthoyts Exp $ - -#load [file join [file dirname [info script]] .. win Release udp107.dll] -#load [file join [file dirname [info script]] .. i386-unknown-openbsd3.6 libudp107.so] -package require udp - -variable forever 0 - -proc Event {sock} { - variable forever - set pkt [read $sock] - set peer [fconfigure $sock -peer] - puts "Recieved [string length $pkt] from $peer\n$pkt" - #set forever 1 - return -} - -proc Listen {port} { - set s [udp_open $port] - fconfigure $s -blocking 0 -buffering none -translation binary - fileevent $s readable [list Event $s] - return $s -} - -proc Exit {sock} { - puts "Exiting" - exit 0 -} - -if {!$tcl_interactive} { - puts "Bug #1158628 - hangs in exit if open udp channels" - puts " Using a buggy version, this will hang after printing Exiting..." - puts "" - set sock [Listen 10245] - puts "Wait 1 sec..." - after 1000 [list Exit $sock] - vwait forever - close $sock -} +#!/usr/bin/env tclsh +# bug1158628.tcl - Copyright (C) 2005 Pat Thoyts +# +# "On windows XP, I have a GUI that has an exit buttons which when +# pressed does: {set done 1; destroy .;exit} If there is an open UDP +# channel with a fileevent on it, the program will not exit -- +# i.e. task manager still shows it. Also if I have the console up, the +# console goes away when the exit button is invoked, but the program +# does not exit. NOTE -- all windows are correctly destroyed (or at +# least withdrawn)" +# +# The fault is calling Tcl_UnregisterChannel in the udpClose function. +# We must let tcl handle this itself. Solved by Reinhard Max. +# +# This script demonstrates the problem. Using udp 1.0.6 the program hangs +# after printing "Exiting...". With the fix applied it properly exits. +# +# $Id: bug1158628.tcl,v 1.2 2005/05/19 20:46:23 patthoyts Exp $ + +#load [file join [file dirname [info script]] .. win Release udp107.dll] +#load [file join [file dirname [info script]] .. i386-unknown-openbsd3.6 libudp107.so] +package require udp + +variable forever 0 + +proc Event {sock} { + variable forever + set pkt [read $sock] + set peer [fconfigure $sock -peer] + puts "Recieved [string length $pkt] from $peer\n$pkt" + #set forever 1 + return +} + +proc Listen {port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary + fileevent $s readable [list Event $s] + return $s +} + +proc Exit {sock} { + puts "Exiting" + exit 0 +} + +if {!$tcl_interactive} { + puts "Bug #1158628 - hangs in exit if open udp channels" + puts " Using a buggy version, this will hang after printing Exiting..." + puts "" + set sock [Listen 10245] + puts "Wait 1 sec..." + after 1000 [list Exit $sock] + vwait forever + close $sock +} diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/chat.tcl b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/chat.tcl similarity index 96% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/chat.tcl rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/chat.tcl index bf3143b9..3cd65509 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/chat.tcl +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/chat.tcl @@ -1,81 +1,81 @@ -#!/usr/bin/env tclsh -# chat.tcl - Copyright (C) 2004 Pat Thoyts -# -# This is a sample application from TclUDP. -# -# This illustrates the use of multicast UDP messages to implement a -# primitive chat application. -# -# $Id: chat.tcl,v 1.2 2007/04/10 23:36:14 patthoyts Exp $ - -package require Tk 8.4- -package require udp 1.0.6 - -variable Address 224.5.1.21 -variable Port 7771 - -proc Receive {sock} { - set pkt [read $sock] - set peer [fconfigure $sock -peer] - AddMessage $peer $pkt - return -} - -proc Start {addr port} { - set s [udp_open $port] - fconfigure $s -blocking 0 -buffering none -translation binary \ - -mcastadd $addr -remote [list $addr $port] - fileevent $s readable [list ::Receive $s] - return $s -} - -proc CreateGui {socket} { - text .t -yscrollcommand {.s set} - scrollbar .s -command {.t yview} - frame .f -border 0 - entry .f.e -textvariable ::_msg - button .f.ok -text Send -underline 0 \ - -command "SendMessage $socket \$::_msg" - button .f.ex -text Exit -underline 1 -command {destroy .} - pack .f.ex .f.ok -side right - pack .f.e -side left -expand 1 -fill x - grid .t .s -sticky news - grid .f - -sticky ew - grid columnconfigure . 0 -weight 1 - grid rowconfigure . 0 -weight 1 - bind .f.e {.f.ok invoke} - .t tag configure CLNT -foreground red - .t configure -tabs {90} -} - -proc SendMessage {sock msg} { - puts -nonewline $sock $msg -} - -proc AddMessage {client msg} { - set msg [string map [list "\r\n" "" "\r" "" "\n" ""] $msg] - set client [lindex $client 0] - if {[string length $msg] > 0} { - .t insert end "$client\t" CLNT "$msg\n" MSG - .t see end - } -} - -proc Main {} { - variable Address - variable Port - variable sock - set sock [Start $Address $Port] - CreateGui $sock - after idle [list SendMessage $sock \ - "$::tcl_platform(user)@[info hostname] connected"] - tkwait window . - close $sock -} - -if {!$tcl_interactive} { - set r [catch [linsert $argv 0 Main] err] - if {$r} {puts $::errorInfo} else {puts $err} - exit 0 -} - +#!/usr/bin/env tclsh +# chat.tcl - Copyright (C) 2004 Pat Thoyts +# +# This is a sample application from TclUDP. +# +# This illustrates the use of multicast UDP messages to implement a +# primitive chat application. +# +# $Id: chat.tcl,v 1.2 2007/04/10 23:36:14 patthoyts Exp $ + +package require Tk 8.4- +package require udp 1.0.6 + +variable Address 224.5.1.21 +variable Port 7771 + +proc Receive {sock} { + set pkt [read $sock] + set peer [fconfigure $sock -peer] + AddMessage $peer $pkt + return +} + +proc Start {addr port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary \ + -mcastadd $addr -remote [list $addr $port] + fileevent $s readable [list ::Receive $s] + return $s +} + +proc CreateGui {socket} { + text .t -yscrollcommand {.s set} + scrollbar .s -command {.t yview} + frame .f -border 0 + entry .f.e -textvariable ::_msg + button .f.ok -text Send -underline 0 \ + -command "SendMessage $socket \$::_msg" + button .f.ex -text Exit -underline 1 -command {destroy .} + pack .f.ex .f.ok -side right + pack .f.e -side left -expand 1 -fill x + grid .t .s -sticky news + grid .f - -sticky ew + grid columnconfigure . 0 -weight 1 + grid rowconfigure . 0 -weight 1 + bind .f.e {.f.ok invoke} + .t tag configure CLNT -foreground red + .t configure -tabs {90} +} + +proc SendMessage {sock msg} { + puts -nonewline $sock $msg +} + +proc AddMessage {client msg} { + set msg [string map [list "\r\n" "" "\r" "" "\n" ""] $msg] + set client [lindex $client 0] + if {[string length $msg] > 0} { + .t insert end "$client\t" CLNT "$msg\n" MSG + .t see end + } +} + +proc Main {} { + variable Address + variable Port + variable sock + set sock [Start $Address $Port] + CreateGui $sock + after idle [list SendMessage $sock \ + "$::tcl_platform(user)@[info hostname] connected"] + tkwait window . + close $sock +} + +if {!$tcl_interactive} { + set r [catch [linsert $argv 0 Main] err] + if {$r} {puts $::errorInfo} else {puts $err} + exit 0 +} + diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/multicast.tcl b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/multicast.tcl similarity index 96% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/multicast.tcl rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/multicast.tcl index 64939828..b0de2ebc 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/multicast.tcl +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/multicast.tcl @@ -1,45 +1,45 @@ -#!/usr/bin/env tclsh -# multicast.tcl - Copyright (C) 2004 Pat Thoyts -# -# Demonstrate the use of IPv4 multicast UDP sockets. -# -# You can send to ths using netcat: -# echo HELLO | nc -u 224.5.1.21 7771 -# -# $Id: multicast.tcl,v 1.3 2007/04/10 23:49:38 patthoyts Exp $ - -package require udp 1.0.6 - -proc udpEvent {chan} { - set data [read $chan] - set peer [fconfigure $chan -peer] - set group [lindex [fconfigure $chan -remote] 0] - puts "$peer ($group) [string length $data] '$data' {[fconfigure $chan]}" - if {[string match "QUIT*" $data]} { - close $chan - set ::forever 1 - } - return -} - -# Select a multicast group and the port number. -# -# We have two groups here to show that it's possible. -# -set group1 224.5.1.21 -set group2 224.5.2.21 -set port 7771 - -# Create a listening socket and configure for sending too. -set s [udp_open $port] -fconfigure $s -buffering none -blocking 0 -fconfigure $s -mcastadd $group2 -remote [list $group2 $port] -fconfigure $s -mcastadd $group1 -remote [list $group1 $port] -fileevent $s readable [list udpEvent $s] - -# Announce our presence and run -puts -nonewline $s "hello, world" -set forever 0 -vwait ::forever - -exit +#!/usr/bin/env tclsh +# multicast.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demonstrate the use of IPv4 multicast UDP sockets. +# +# You can send to ths using netcat: +# echo HELLO | nc -u 224.5.1.21 7771 +# +# $Id: multicast.tcl,v 1.3 2007/04/10 23:49:38 patthoyts Exp $ + +package require udp 1.0.6 + +proc udpEvent {chan} { + set data [read $chan] + set peer [fconfigure $chan -peer] + set group [lindex [fconfigure $chan -remote] 0] + puts "$peer ($group) [string length $data] '$data' {[fconfigure $chan]}" + if {[string match "QUIT*" $data]} { + close $chan + set ::forever 1 + } + return +} + +# Select a multicast group and the port number. +# +# We have two groups here to show that it's possible. +# +set group1 224.5.1.21 +set group2 224.5.2.21 +set port 7771 + +# Create a listening socket and configure for sending too. +set s [udp_open $port] +fconfigure $s -buffering none -blocking 0 +fconfigure $s -mcastadd $group2 -remote [list $group2 $port] +fconfigure $s -mcastadd $group1 -remote [list $group1 $port] +fileevent $s readable [list udpEvent $s] + +# Announce our presence and run +puts -nonewline $s "hello, world" +set forever 0 +vwait ::forever + +exit diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/udpcat.tcl b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/udpcat.tcl similarity index 96% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/udpcat.tcl rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/udpcat.tcl index 3b1bf255..284aec67 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/udpcat.tcl +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/demos/udpcat.tcl @@ -1,65 +1,65 @@ -#!/usr/bin/env tclsh -# udpsend.tcl - Copyright (C) 2004 Pat Thoyts -# -# Demo application - cat data from stdin via a UDP socket. -# -# $Id: udpcat.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ - -package require udp 1.0.6 - -proc Event {sock} { - global forever - set pkt [read $sock] - set peer [fconfigure $sock -peer] - puts "Received [string length $pkt] from $peer\n$pkt" - set forever 1 - return -} - -proc Send {host port {msg {}}} { - set s [udp_open] - fconfigure $s -blocking 0 -buffering none -translation binary \ - -remote [list $host $port] - fileevent $s readable [list Event $s] - if {$msg eq {}} { - fcopy stdin $s - } else { - puts -nonewline $s $msg - } - - after 2000 - close $s -} - -proc Listen {port} { - set s [udp_open $port] - fconfigure $s -blocking 0 -buffering none -translation binary - fileevent $s readable [list Event $s] - return $s -} - -# ------------------------------------------------------------------------- -# Runtime -# udpsend listen -port N -blocking 0 -# udpsend send host port message -# ------------------------------------------------------------------------- -set forever 0 - -if {! $tcl_interactive} { - switch -exact -- [set cmd [lindex $argv 0]] { - send { - eval [list Send] [lrange $argv 1 end] - } - listen { - set s [Listen [lindex $argv 1]] - vwait ::forever - close $s - } - default { - puts "usage: udpcat send host port ?message?\ - \n udpcat listen port" - } - } -} - - +#!/usr/bin/env tclsh +# udpsend.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demo application - cat data from stdin via a UDP socket. +# +# $Id: udpcat.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ + +package require udp 1.0.6 + +proc Event {sock} { + global forever + set pkt [read $sock] + set peer [fconfigure $sock -peer] + puts "Received [string length $pkt] from $peer\n$pkt" + set forever 1 + return +} + +proc Send {host port {msg {}}} { + set s [udp_open] + fconfigure $s -blocking 0 -buffering none -translation binary \ + -remote [list $host $port] + fileevent $s readable [list Event $s] + if {$msg eq {}} { + fcopy stdin $s + } else { + puts -nonewline $s $msg + } + + after 2000 + close $s +} + +proc Listen {port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary + fileevent $s readable [list Event $s] + return $s +} + +# ------------------------------------------------------------------------- +# Runtime +# udpsend listen -port N -blocking 0 +# udpsend send host port message +# ------------------------------------------------------------------------- +set forever 0 + +if {! $tcl_interactive} { + switch -exact -- [set cmd [lindex $argv 0]] { + send { + eval [list Send] [lrange $argv 1 end] + } + listen { + set s [Listen [lindex $argv 1]] + vwait ::forever + close $s + } + default { + puts "usage: udpcat send host port ?message?\ + \n udpcat listen port" + } + } +} + + diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/pkgIndex.tcl b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/pkgIndex.tcl similarity index 66% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/pkgIndex.tcl rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/pkgIndex.tcl index 42f0856e..ba2ae7e1 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/pkgIndex.tcl +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/pkgIndex.tcl @@ -2,9 +2,9 @@ # Tcl package index file, version 1.1 # if {[package vsatisfies [package provide Tcl] 9.0-]} { - package ifneeded udp 1.0.12 [list apply {{dir} { + package ifneeded udp 1.0.13 [list apply {{dir} { # Load library - load [file join $dir tcl9udp1012.dll] [string totitle udp] + load [file join $dir tcl9udp1013.dll] [string totitle udp] # Source init file set initScript [file join $dir udp.tcl] @@ -14,11 +14,11 @@ if {[package vsatisfies [package provide Tcl] 9.0-]} { }} $dir] } else { if {![package vsatisfies [package provide Tcl] 8.5]} {return} - package ifneeded udp 1.0.12 [list apply {{dir} { + package ifneeded udp 1.0.13 [list apply {{dir} { # Load library - if {[string tolower [file extension udp1012t.dll]] in [list .dll .dylib .so]} { + if {[string tolower [file extension udp1013t.dll]] in [list .dll .dylib .so]} { # Load dynamic library - load [file join $dir udp1012t.dll] [string totitle udp] + load [file join $dir udp1013t.dll] [string totitle udp] } else { # Static library load {} [string totitle udp] diff --git a/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/tcl9udp1013.dll b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/tcl9udp1013.dll new file mode 100644 index 00000000..097011cc Binary files /dev/null and b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/tcl9udp1013.dll differ diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/udp.html b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/udp.html similarity index 96% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/udp.html rename to src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/udp.html index 60b0ebf3..0366618f 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/udp.html +++ b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/udp.html @@ -100,7 +100,7 @@
-

udp(n) 1.0.12 udp "Tcl UDP extension"

+

udp(n) 1.0.13 udp "Tcl UDP extension"

Name

udp - Create UDP sockets in Tcl

@@ -120,8 +120,8 @@

Synopsis

    -
  • package require Tcl 8.5
  • -
  • package require udp 1.0.12
  • +
  • package require Tcl 8.5-
  • +
  • package require udp 1.0.13
  • udp_open ?localport? ?reuse? ?ipv6?
  • @@ -315,7 +315,7 @@ Extension Architecture by Pat Thoyts.

    Support for IPv6 and allowing a multicast join on a specific network interface is added by Huub Eikens.

See Also

-

socket(n)

+

socket

Keywords

I/O, IP Address, TclUDP, UDP, asynchronous I/O, bind, channel, connection, domain, host, name, network, network address, networking, socket, udp

diff --git a/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/udp1013t.dll b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/udp1013t.dll new file mode 100644 index 00000000..11a3784f Binary files /dev/null and b/src/vendorlib_tcl9/win32-x86_64/tcludp1.0.13/udp1013t.dll differ diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/broadcast.tcl b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/broadcast.tcl similarity index 96% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/broadcast.tcl rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/broadcast.tcl index a5badc5a..e4c1bfbc 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/broadcast.tcl +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/broadcast.tcl @@ -1,39 +1,39 @@ -#!/usr/bin/env tclsh -# multicast.tcl - Copyright (C) 2004 Pat Thoyts -# -# Demonstrate the use of broadcast UDP sockets. -# -# You can send to ths using netcat: -# echo HELLO | nc -u 192.168.255.255 7772 -# -# $Id: broadcast.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ - -package require udp 1.0.6 - -proc udpEvent {chan} { - set data [read $chan] - set peer [fconfigure $chan -peer] - puts "$peer [string length $data] '$data'" - if {[string match "QUIT*" $data]} { - close $chan - set ::forever 1 - } - return -} - -# Select a subnet and the port number. -set subnet 192.168.255.255 -set port 7772 - -# Create a listening socket and configure for sending too. -set s [udp_open $port] -fconfigure $s -buffering none -blocking 0 -fconfigure $s -broadcast 1 -remote [list $subnet $port] -fileevent $s readable [list udpEvent $s] - -# Announce our presence and run -puts -nonewline $s "hello, world" -set forever 0 -vwait ::forever - -exit +#!/usr/bin/env tclsh +# multicast.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demonstrate the use of broadcast UDP sockets. +# +# You can send to ths using netcat: +# echo HELLO | nc -u 192.168.255.255 7772 +# +# $Id: broadcast.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ + +package require udp 1.0.6 + +proc udpEvent {chan} { + set data [read $chan] + set peer [fconfigure $chan -peer] + puts "$peer [string length $data] '$data'" + if {[string match "QUIT*" $data]} { + close $chan + set ::forever 1 + } + return +} + +# Select a subnet and the port number. +set subnet 192.168.255.255 +set port 7772 + +# Create a listening socket and configure for sending too. +set s [udp_open $port] +fconfigure $s -buffering none -blocking 0 +fconfigure $s -broadcast 1 -remote [list $subnet $port] +fileevent $s readable [list udpEvent $s] + +# Announce our presence and run +puts -nonewline $s "hello, world" +set forever 0 +vwait ::forever + +exit diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/bug1158628.tcl b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/bug1158628.tcl similarity index 96% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/bug1158628.tcl rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/bug1158628.tcl index e32a2ed7..be3c2c5f 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/bug1158628.tcl +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/bug1158628.tcl @@ -1,56 +1,56 @@ -#!/usr/bin/env tclsh -# bug1158628.tcl - Copyright (C) 2005 Pat Thoyts -# -# "On windows XP, I have a GUI that has an exit buttons which when -# pressed does: {set done 1; destroy .;exit} If there is an open UDP -# channel with a fileevent on it, the program will not exit -- -# i.e. task manager still shows it. Also if I have the console up, the -# console goes away when the exit button is invoked, but the program -# does not exit. NOTE -- all windows are correctly destroyed (or at -# least withdrawn)" -# -# The fault is calling Tcl_UnregisterChannel in the udpClose function. -# We must let tcl handle this itself. Solved by Reinhard Max. -# -# This script demonstrates the problem. Using udp 1.0.6 the program hangs -# after printing "Exiting...". With the fix applied it properly exits. -# -# $Id: bug1158628.tcl,v 1.2 2005/05/19 20:46:23 patthoyts Exp $ - -#load [file join [file dirname [info script]] .. win Release udp107.dll] -#load [file join [file dirname [info script]] .. i386-unknown-openbsd3.6 libudp107.so] -package require udp - -variable forever 0 - -proc Event {sock} { - variable forever - set pkt [read $sock] - set peer [fconfigure $sock -peer] - puts "Recieved [string length $pkt] from $peer\n$pkt" - #set forever 1 - return -} - -proc Listen {port} { - set s [udp_open $port] - fconfigure $s -blocking 0 -buffering none -translation binary - fileevent $s readable [list Event $s] - return $s -} - -proc Exit {sock} { - puts "Exiting" - exit 0 -} - -if {!$tcl_interactive} { - puts "Bug #1158628 - hangs in exit if open udp channels" - puts " Using a buggy version, this will hang after printing Exiting..." - puts "" - set sock [Listen 10245] - puts "Wait 1 sec..." - after 1000 [list Exit $sock] - vwait forever - close $sock -} +#!/usr/bin/env tclsh +# bug1158628.tcl - Copyright (C) 2005 Pat Thoyts +# +# "On windows XP, I have a GUI that has an exit buttons which when +# pressed does: {set done 1; destroy .;exit} If there is an open UDP +# channel with a fileevent on it, the program will not exit -- +# i.e. task manager still shows it. Also if I have the console up, the +# console goes away when the exit button is invoked, but the program +# does not exit. NOTE -- all windows are correctly destroyed (or at +# least withdrawn)" +# +# The fault is calling Tcl_UnregisterChannel in the udpClose function. +# We must let tcl handle this itself. Solved by Reinhard Max. +# +# This script demonstrates the problem. Using udp 1.0.6 the program hangs +# after printing "Exiting...". With the fix applied it properly exits. +# +# $Id: bug1158628.tcl,v 1.2 2005/05/19 20:46:23 patthoyts Exp $ + +#load [file join [file dirname [info script]] .. win Release udp107.dll] +#load [file join [file dirname [info script]] .. i386-unknown-openbsd3.6 libudp107.so] +package require udp + +variable forever 0 + +proc Event {sock} { + variable forever + set pkt [read $sock] + set peer [fconfigure $sock -peer] + puts "Recieved [string length $pkt] from $peer\n$pkt" + #set forever 1 + return +} + +proc Listen {port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary + fileevent $s readable [list Event $s] + return $s +} + +proc Exit {sock} { + puts "Exiting" + exit 0 +} + +if {!$tcl_interactive} { + puts "Bug #1158628 - hangs in exit if open udp channels" + puts " Using a buggy version, this will hang after printing Exiting..." + puts "" + set sock [Listen 10245] + puts "Wait 1 sec..." + after 1000 [list Exit $sock] + vwait forever + close $sock +} diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/chat.tcl b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/chat.tcl similarity index 96% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/chat.tcl rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/chat.tcl index bf3143b9..3cd65509 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/chat.tcl +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/chat.tcl @@ -1,81 +1,81 @@ -#!/usr/bin/env tclsh -# chat.tcl - Copyright (C) 2004 Pat Thoyts -# -# This is a sample application from TclUDP. -# -# This illustrates the use of multicast UDP messages to implement a -# primitive chat application. -# -# $Id: chat.tcl,v 1.2 2007/04/10 23:36:14 patthoyts Exp $ - -package require Tk 8.4- -package require udp 1.0.6 - -variable Address 224.5.1.21 -variable Port 7771 - -proc Receive {sock} { - set pkt [read $sock] - set peer [fconfigure $sock -peer] - AddMessage $peer $pkt - return -} - -proc Start {addr port} { - set s [udp_open $port] - fconfigure $s -blocking 0 -buffering none -translation binary \ - -mcastadd $addr -remote [list $addr $port] - fileevent $s readable [list ::Receive $s] - return $s -} - -proc CreateGui {socket} { - text .t -yscrollcommand {.s set} - scrollbar .s -command {.t yview} - frame .f -border 0 - entry .f.e -textvariable ::_msg - button .f.ok -text Send -underline 0 \ - -command "SendMessage $socket \$::_msg" - button .f.ex -text Exit -underline 1 -command {destroy .} - pack .f.ex .f.ok -side right - pack .f.e -side left -expand 1 -fill x - grid .t .s -sticky news - grid .f - -sticky ew - grid columnconfigure . 0 -weight 1 - grid rowconfigure . 0 -weight 1 - bind .f.e {.f.ok invoke} - .t tag configure CLNT -foreground red - .t configure -tabs {90} -} - -proc SendMessage {sock msg} { - puts -nonewline $sock $msg -} - -proc AddMessage {client msg} { - set msg [string map [list "\r\n" "" "\r" "" "\n" ""] $msg] - set client [lindex $client 0] - if {[string length $msg] > 0} { - .t insert end "$client\t" CLNT "$msg\n" MSG - .t see end - } -} - -proc Main {} { - variable Address - variable Port - variable sock - set sock [Start $Address $Port] - CreateGui $sock - after idle [list SendMessage $sock \ - "$::tcl_platform(user)@[info hostname] connected"] - tkwait window . - close $sock -} - -if {!$tcl_interactive} { - set r [catch [linsert $argv 0 Main] err] - if {$r} {puts $::errorInfo} else {puts $err} - exit 0 -} - +#!/usr/bin/env tclsh +# chat.tcl - Copyright (C) 2004 Pat Thoyts +# +# This is a sample application from TclUDP. +# +# This illustrates the use of multicast UDP messages to implement a +# primitive chat application. +# +# $Id: chat.tcl,v 1.2 2007/04/10 23:36:14 patthoyts Exp $ + +package require Tk 8.4- +package require udp 1.0.6 + +variable Address 224.5.1.21 +variable Port 7771 + +proc Receive {sock} { + set pkt [read $sock] + set peer [fconfigure $sock -peer] + AddMessage $peer $pkt + return +} + +proc Start {addr port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary \ + -mcastadd $addr -remote [list $addr $port] + fileevent $s readable [list ::Receive $s] + return $s +} + +proc CreateGui {socket} { + text .t -yscrollcommand {.s set} + scrollbar .s -command {.t yview} + frame .f -border 0 + entry .f.e -textvariable ::_msg + button .f.ok -text Send -underline 0 \ + -command "SendMessage $socket \$::_msg" + button .f.ex -text Exit -underline 1 -command {destroy .} + pack .f.ex .f.ok -side right + pack .f.e -side left -expand 1 -fill x + grid .t .s -sticky news + grid .f - -sticky ew + grid columnconfigure . 0 -weight 1 + grid rowconfigure . 0 -weight 1 + bind .f.e {.f.ok invoke} + .t tag configure CLNT -foreground red + .t configure -tabs {90} +} + +proc SendMessage {sock msg} { + puts -nonewline $sock $msg +} + +proc AddMessage {client msg} { + set msg [string map [list "\r\n" "" "\r" "" "\n" ""] $msg] + set client [lindex $client 0] + if {[string length $msg] > 0} { + .t insert end "$client\t" CLNT "$msg\n" MSG + .t see end + } +} + +proc Main {} { + variable Address + variable Port + variable sock + set sock [Start $Address $Port] + CreateGui $sock + after idle [list SendMessage $sock \ + "$::tcl_platform(user)@[info hostname] connected"] + tkwait window . + close $sock +} + +if {!$tcl_interactive} { + set r [catch [linsert $argv 0 Main] err] + if {$r} {puts $::errorInfo} else {puts $err} + exit 0 +} + diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/multicast.tcl b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/multicast.tcl similarity index 96% rename from src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/multicast.tcl rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/multicast.tcl index 64939828..b0de2ebc 100644 --- a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/demos/multicast.tcl +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/multicast.tcl @@ -1,45 +1,45 @@ -#!/usr/bin/env tclsh -# multicast.tcl - Copyright (C) 2004 Pat Thoyts -# -# Demonstrate the use of IPv4 multicast UDP sockets. -# -# You can send to ths using netcat: -# echo HELLO | nc -u 224.5.1.21 7771 -# -# $Id: multicast.tcl,v 1.3 2007/04/10 23:49:38 patthoyts Exp $ - -package require udp 1.0.6 - -proc udpEvent {chan} { - set data [read $chan] - set peer [fconfigure $chan -peer] - set group [lindex [fconfigure $chan -remote] 0] - puts "$peer ($group) [string length $data] '$data' {[fconfigure $chan]}" - if {[string match "QUIT*" $data]} { - close $chan - set ::forever 1 - } - return -} - -# Select a multicast group and the port number. -# -# We have two groups here to show that it's possible. -# -set group1 224.5.1.21 -set group2 224.5.2.21 -set port 7771 - -# Create a listening socket and configure for sending too. -set s [udp_open $port] -fconfigure $s -buffering none -blocking 0 -fconfigure $s -mcastadd $group2 -remote [list $group2 $port] -fconfigure $s -mcastadd $group1 -remote [list $group1 $port] -fileevent $s readable [list udpEvent $s] - -# Announce our presence and run -puts -nonewline $s "hello, world" -set forever 0 -vwait ::forever - -exit +#!/usr/bin/env tclsh +# multicast.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demonstrate the use of IPv4 multicast UDP sockets. +# +# You can send to ths using netcat: +# echo HELLO | nc -u 224.5.1.21 7771 +# +# $Id: multicast.tcl,v 1.3 2007/04/10 23:49:38 patthoyts Exp $ + +package require udp 1.0.6 + +proc udpEvent {chan} { + set data [read $chan] + set peer [fconfigure $chan -peer] + set group [lindex [fconfigure $chan -remote] 0] + puts "$peer ($group) [string length $data] '$data' {[fconfigure $chan]}" + if {[string match "QUIT*" $data]} { + close $chan + set ::forever 1 + } + return +} + +# Select a multicast group and the port number. +# +# We have two groups here to show that it's possible. +# +set group1 224.5.1.21 +set group2 224.5.2.21 +set port 7771 + +# Create a listening socket and configure for sending too. +set s [udp_open $port] +fconfigure $s -buffering none -blocking 0 +fconfigure $s -mcastadd $group2 -remote [list $group2 $port] +fconfigure $s -mcastadd $group1 -remote [list $group1 $port] +fileevent $s readable [list udpEvent $s] + +# Announce our presence and run +puts -nonewline $s "hello, world" +set forever 0 +vwait ::forever + +exit diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/udpcat.tcl b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/udpcat.tcl similarity index 96% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/udpcat.tcl rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/udpcat.tcl index 3b1bf255..284aec67 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/demos/udpcat.tcl +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/demos/udpcat.tcl @@ -1,65 +1,65 @@ -#!/usr/bin/env tclsh -# udpsend.tcl - Copyright (C) 2004 Pat Thoyts -# -# Demo application - cat data from stdin via a UDP socket. -# -# $Id: udpcat.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ - -package require udp 1.0.6 - -proc Event {sock} { - global forever - set pkt [read $sock] - set peer [fconfigure $sock -peer] - puts "Received [string length $pkt] from $peer\n$pkt" - set forever 1 - return -} - -proc Send {host port {msg {}}} { - set s [udp_open] - fconfigure $s -blocking 0 -buffering none -translation binary \ - -remote [list $host $port] - fileevent $s readable [list Event $s] - if {$msg eq {}} { - fcopy stdin $s - } else { - puts -nonewline $s $msg - } - - after 2000 - close $s -} - -proc Listen {port} { - set s [udp_open $port] - fconfigure $s -blocking 0 -buffering none -translation binary - fileevent $s readable [list Event $s] - return $s -} - -# ------------------------------------------------------------------------- -# Runtime -# udpsend listen -port N -blocking 0 -# udpsend send host port message -# ------------------------------------------------------------------------- -set forever 0 - -if {! $tcl_interactive} { - switch -exact -- [set cmd [lindex $argv 0]] { - send { - eval [list Send] [lrange $argv 1 end] - } - listen { - set s [Listen [lindex $argv 1]] - vwait ::forever - close $s - } - default { - puts "usage: udpcat send host port ?message?\ - \n udpcat listen port" - } - } -} - - +#!/usr/bin/env tclsh +# udpsend.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demo application - cat data from stdin via a UDP socket. +# +# $Id: udpcat.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ + +package require udp 1.0.6 + +proc Event {sock} { + global forever + set pkt [read $sock] + set peer [fconfigure $sock -peer] + puts "Received [string length $pkt] from $peer\n$pkt" + set forever 1 + return +} + +proc Send {host port {msg {}}} { + set s [udp_open] + fconfigure $s -blocking 0 -buffering none -translation binary \ + -remote [list $host $port] + fileevent $s readable [list Event $s] + if {$msg eq {}} { + fcopy stdin $s + } else { + puts -nonewline $s $msg + } + + after 2000 + close $s +} + +proc Listen {port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary + fileevent $s readable [list Event $s] + return $s +} + +# ------------------------------------------------------------------------- +# Runtime +# udpsend listen -port N -blocking 0 +# udpsend send host port message +# ------------------------------------------------------------------------- +set forever 0 + +if {! $tcl_interactive} { + switch -exact -- [set cmd [lindex $argv 0]] { + send { + eval [list Send] [lrange $argv 1 end] + } + listen { + set s [Listen [lindex $argv 1]] + vwait ::forever + close $s + } + default { + puts "usage: udpcat send host port ?message?\ + \n udpcat listen port" + } + } +} + + diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/pkgIndex.tcl b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/pkgIndex.tcl similarity index 66% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/pkgIndex.tcl rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/pkgIndex.tcl index 42f0856e..ba2ae7e1 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/pkgIndex.tcl +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/pkgIndex.tcl @@ -2,9 +2,9 @@ # Tcl package index file, version 1.1 # if {[package vsatisfies [package provide Tcl] 9.0-]} { - package ifneeded udp 1.0.12 [list apply {{dir} { + package ifneeded udp 1.0.13 [list apply {{dir} { # Load library - load [file join $dir tcl9udp1012.dll] [string totitle udp] + load [file join $dir tcl9udp1013.dll] [string totitle udp] # Source init file set initScript [file join $dir udp.tcl] @@ -14,11 +14,11 @@ if {[package vsatisfies [package provide Tcl] 9.0-]} { }} $dir] } else { if {![package vsatisfies [package provide Tcl] 8.5]} {return} - package ifneeded udp 1.0.12 [list apply {{dir} { + package ifneeded udp 1.0.13 [list apply {{dir} { # Load library - if {[string tolower [file extension udp1012t.dll]] in [list .dll .dylib .so]} { + if {[string tolower [file extension udp1013t.dll]] in [list .dll .dylib .so]} { # Load dynamic library - load [file join $dir udp1012t.dll] [string totitle udp] + load [file join $dir udp1013t.dll] [string totitle udp] } else { # Static library load {} [string totitle udp] diff --git a/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/tcl9udp1013.dll b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/tcl9udp1013.dll new file mode 100644 index 00000000..097011cc Binary files /dev/null and b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/tcl9udp1013.dll differ diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/udp.html b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/udp.html similarity index 96% rename from src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/udp.html rename to src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/udp.html index 60b0ebf3..0366618f 100644 --- a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/udp.html +++ b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/udp.html @@ -100,7 +100,7 @@
-

udp(n) 1.0.12 udp "Tcl UDP extension"

+

udp(n) 1.0.13 udp "Tcl UDP extension"

Name

udp - Create UDP sockets in Tcl

@@ -120,8 +120,8 @@

Synopsis

    -
  • package require Tcl 8.5
  • -
  • package require udp 1.0.12
  • +
  • package require Tcl 8.5-
  • +
  • package require udp 1.0.13
  • udp_open ?localport? ?reuse? ?ipv6?
  • @@ -315,7 +315,7 @@ Extension Architecture by Pat Thoyts.

    Support for IPv6 and allowing a multicast join on a specific network interface is added by Huub Eikens.

See Also

-

socket(n)

+

socket

Keywords

I/O, IP Address, TclUDP, UDP, asynchronous I/O, bind, channel, connection, domain, host, name, network, network address, networking, socket, udp

diff --git a/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/udp1013t.dll b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/udp1013t.dll new file mode 100644 index 00000000..11a3784f Binary files /dev/null and b/src/vfs/punk9win.vfs/lib_tcl9/tcludp1.0.13/udp1013t.dll differ diff --git a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/tcl9udp1012.dll b/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/tcl9udp1012.dll deleted file mode 100644 index b895ff99..00000000 Binary files a/src/vfs/punk9win.vfs/lib_tcl9/udp1.0.12/tcl9udp1012.dll and /dev/null differ diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/broadcast.tcl b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/broadcast.tcl new file mode 100644 index 00000000..e4c1bfbc --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/broadcast.tcl @@ -0,0 +1,39 @@ +#!/usr/bin/env tclsh +# multicast.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demonstrate the use of broadcast UDP sockets. +# +# You can send to ths using netcat: +# echo HELLO | nc -u 192.168.255.255 7772 +# +# $Id: broadcast.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ + +package require udp 1.0.6 + +proc udpEvent {chan} { + set data [read $chan] + set peer [fconfigure $chan -peer] + puts "$peer [string length $data] '$data'" + if {[string match "QUIT*" $data]} { + close $chan + set ::forever 1 + } + return +} + +# Select a subnet and the port number. +set subnet 192.168.255.255 +set port 7772 + +# Create a listening socket and configure for sending too. +set s [udp_open $port] +fconfigure $s -buffering none -blocking 0 +fconfigure $s -broadcast 1 -remote [list $subnet $port] +fileevent $s readable [list udpEvent $s] + +# Announce our presence and run +puts -nonewline $s "hello, world" +set forever 0 +vwait ::forever + +exit diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/bug1158628.tcl b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/bug1158628.tcl new file mode 100644 index 00000000..be3c2c5f --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/bug1158628.tcl @@ -0,0 +1,56 @@ +#!/usr/bin/env tclsh +# bug1158628.tcl - Copyright (C) 2005 Pat Thoyts +# +# "On windows XP, I have a GUI that has an exit buttons which when +# pressed does: {set done 1; destroy .;exit} If there is an open UDP +# channel with a fileevent on it, the program will not exit -- +# i.e. task manager still shows it. Also if I have the console up, the +# console goes away when the exit button is invoked, but the program +# does not exit. NOTE -- all windows are correctly destroyed (or at +# least withdrawn)" +# +# The fault is calling Tcl_UnregisterChannel in the udpClose function. +# We must let tcl handle this itself. Solved by Reinhard Max. +# +# This script demonstrates the problem. Using udp 1.0.6 the program hangs +# after printing "Exiting...". With the fix applied it properly exits. +# +# $Id: bug1158628.tcl,v 1.2 2005/05/19 20:46:23 patthoyts Exp $ + +#load [file join [file dirname [info script]] .. win Release udp107.dll] +#load [file join [file dirname [info script]] .. i386-unknown-openbsd3.6 libudp107.so] +package require udp + +variable forever 0 + +proc Event {sock} { + variable forever + set pkt [read $sock] + set peer [fconfigure $sock -peer] + puts "Recieved [string length $pkt] from $peer\n$pkt" + #set forever 1 + return +} + +proc Listen {port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary + fileevent $s readable [list Event $s] + return $s +} + +proc Exit {sock} { + puts "Exiting" + exit 0 +} + +if {!$tcl_interactive} { + puts "Bug #1158628 - hangs in exit if open udp channels" + puts " Using a buggy version, this will hang after printing Exiting..." + puts "" + set sock [Listen 10245] + puts "Wait 1 sec..." + after 1000 [list Exit $sock] + vwait forever + close $sock +} diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/chat.tcl b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/chat.tcl new file mode 100644 index 00000000..3cd65509 --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/chat.tcl @@ -0,0 +1,81 @@ +#!/usr/bin/env tclsh +# chat.tcl - Copyright (C) 2004 Pat Thoyts +# +# This is a sample application from TclUDP. +# +# This illustrates the use of multicast UDP messages to implement a +# primitive chat application. +# +# $Id: chat.tcl,v 1.2 2007/04/10 23:36:14 patthoyts Exp $ + +package require Tk 8.4- +package require udp 1.0.6 + +variable Address 224.5.1.21 +variable Port 7771 + +proc Receive {sock} { + set pkt [read $sock] + set peer [fconfigure $sock -peer] + AddMessage $peer $pkt + return +} + +proc Start {addr port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary \ + -mcastadd $addr -remote [list $addr $port] + fileevent $s readable [list ::Receive $s] + return $s +} + +proc CreateGui {socket} { + text .t -yscrollcommand {.s set} + scrollbar .s -command {.t yview} + frame .f -border 0 + entry .f.e -textvariable ::_msg + button .f.ok -text Send -underline 0 \ + -command "SendMessage $socket \$::_msg" + button .f.ex -text Exit -underline 1 -command {destroy .} + pack .f.ex .f.ok -side right + pack .f.e -side left -expand 1 -fill x + grid .t .s -sticky news + grid .f - -sticky ew + grid columnconfigure . 0 -weight 1 + grid rowconfigure . 0 -weight 1 + bind .f.e {.f.ok invoke} + .t tag configure CLNT -foreground red + .t configure -tabs {90} +} + +proc SendMessage {sock msg} { + puts -nonewline $sock $msg +} + +proc AddMessage {client msg} { + set msg [string map [list "\r\n" "" "\r" "" "\n" ""] $msg] + set client [lindex $client 0] + if {[string length $msg] > 0} { + .t insert end "$client\t" CLNT "$msg\n" MSG + .t see end + } +} + +proc Main {} { + variable Address + variable Port + variable sock + set sock [Start $Address $Port] + CreateGui $sock + after idle [list SendMessage $sock \ + "$::tcl_platform(user)@[info hostname] connected"] + tkwait window . + close $sock +} + +if {!$tcl_interactive} { + set r [catch [linsert $argv 0 Main] err] + if {$r} {puts $::errorInfo} else {puts $err} + exit 0 +} + diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/multicast.tcl b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/multicast.tcl new file mode 100644 index 00000000..b0de2ebc --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/multicast.tcl @@ -0,0 +1,45 @@ +#!/usr/bin/env tclsh +# multicast.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demonstrate the use of IPv4 multicast UDP sockets. +# +# You can send to ths using netcat: +# echo HELLO | nc -u 224.5.1.21 7771 +# +# $Id: multicast.tcl,v 1.3 2007/04/10 23:49:38 patthoyts Exp $ + +package require udp 1.0.6 + +proc udpEvent {chan} { + set data [read $chan] + set peer [fconfigure $chan -peer] + set group [lindex [fconfigure $chan -remote] 0] + puts "$peer ($group) [string length $data] '$data' {[fconfigure $chan]}" + if {[string match "QUIT*" $data]} { + close $chan + set ::forever 1 + } + return +} + +# Select a multicast group and the port number. +# +# We have two groups here to show that it's possible. +# +set group1 224.5.1.21 +set group2 224.5.2.21 +set port 7771 + +# Create a listening socket and configure for sending too. +set s [udp_open $port] +fconfigure $s -buffering none -blocking 0 +fconfigure $s -mcastadd $group2 -remote [list $group2 $port] +fconfigure $s -mcastadd $group1 -remote [list $group1 $port] +fileevent $s readable [list udpEvent $s] + +# Announce our presence and run +puts -nonewline $s "hello, world" +set forever 0 +vwait ::forever + +exit diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/udpcat.tcl b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/udpcat.tcl new file mode 100644 index 00000000..284aec67 --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/demos/udpcat.tcl @@ -0,0 +1,65 @@ +#!/usr/bin/env tclsh +# udpsend.tcl - Copyright (C) 2004 Pat Thoyts +# +# Demo application - cat data from stdin via a UDP socket. +# +# $Id: udpcat.tcl,v 1.1 2004/11/22 23:48:47 patthoyts Exp $ + +package require udp 1.0.6 + +proc Event {sock} { + global forever + set pkt [read $sock] + set peer [fconfigure $sock -peer] + puts "Received [string length $pkt] from $peer\n$pkt" + set forever 1 + return +} + +proc Send {host port {msg {}}} { + set s [udp_open] + fconfigure $s -blocking 0 -buffering none -translation binary \ + -remote [list $host $port] + fileevent $s readable [list Event $s] + if {$msg eq {}} { + fcopy stdin $s + } else { + puts -nonewline $s $msg + } + + after 2000 + close $s +} + +proc Listen {port} { + set s [udp_open $port] + fconfigure $s -blocking 0 -buffering none -translation binary + fileevent $s readable [list Event $s] + return $s +} + +# ------------------------------------------------------------------------- +# Runtime +# udpsend listen -port N -blocking 0 +# udpsend send host port message +# ------------------------------------------------------------------------- +set forever 0 + +if {! $tcl_interactive} { + switch -exact -- [set cmd [lindex $argv 0]] { + send { + eval [list Send] [lrange $argv 1 end] + } + listen { + set s [Listen [lindex $argv 1]] + vwait ::forever + close $s + } + default { + puts "usage: udpcat send host port ?message?\ + \n udpcat listen port" + } + } +} + + diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/pkgIndex.tcl b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/pkgIndex.tcl new file mode 100644 index 00000000..ba2ae7e1 --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/pkgIndex.tcl @@ -0,0 +1,33 @@ +# -*- tcl -*- +# Tcl package index file, version 1.1 +# +if {[package vsatisfies [package provide Tcl] 9.0-]} { + package ifneeded udp 1.0.13 [list apply {{dir} { + # Load library + load [file join $dir tcl9udp1013.dll] [string totitle udp] + + # Source init file + set initScript [file join $dir udp.tcl] + if {[file exists $initScript]} { + source -encoding utf-8 $initScript + } + }} $dir] +} else { + if {![package vsatisfies [package provide Tcl] 8.5]} {return} + package ifneeded udp 1.0.13 [list apply {{dir} { + # Load library + if {[string tolower [file extension udp1013t.dll]] in [list .dll .dylib .so]} { + # Load dynamic library + load [file join $dir udp1013t.dll] [string totitle udp] + } else { + # Static library + load {} [string totitle udp] + } + + # Source init file + set initScript [file join $dir udp.tcl] + if {[file exists $initScript]} { + source -encoding utf-8 $initScript + } + }} $dir] +} diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/tcl9udp1013.dll b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/tcl9udp1013.dll new file mode 100644 index 00000000..097011cc Binary files /dev/null and b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/tcl9udp1013.dll differ diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/udp.html b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/udp.html new file mode 100644 index 00000000..0366618f --- /dev/null +++ b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/udp.html @@ -0,0 +1,326 @@ + + + +udp - Tcl UDP extension + + + + + +
+

udp(n) 1.0.13 udp "Tcl UDP extension"

+

Name

+

udp - Create UDP sockets in Tcl

+
+ + +

Description

+

This package provides support for using UDP through Tcl. The package provides +a new channel type and attempts to permit the use of packet oriented UDP +over stream oriented Tcl channels. The package defined three commands but +udp_conf should be considered depreciated in favor of the standard +Tcl command fconfigure.

+
+

COMMANDS

+
+
udp_open ?localport? ?reuse? ?ipv6?
+

udp_open will open a UDP socket. If a localport is specified the UDP +socket will be opened on that port. Otherwise the system will choose a port +and the user can use the udp_conf command to obtain the port number +if required.

+

The following keywords can be used to specify options on the opened socket.

+
+
reuse
+

Using this keyword sets the SO_REUSEADDR socket option which permits multiple +sockets to be bound to the same address/port combination.

+
ipv6
+

By default a IPv4 socket is created. When keyword ipv6 is specified, an IPv6 +socket is opened.

+
+
udp_conf channel host port
+

Deprecated in favor of the standard Tcl fconfigure or +chan configure commands.

+

udp_conf in this configuration is used to specify the remote destination +for packets written to this channel. You must call this command before +writing data to the UDP socket.

+
udp_conf channel ?optionName? ?value? ?optionName value ...?
+

Deprecated in favor of the standard Tcl fconfigure or +chan configure commands.

+

In addition to being used to configure the remote host, the udp_conf +command is used to obtain information about the UDP socket. NOTE all these +options are now available using the standard Tcl fconfigure or +chan configure command.

+
+
-myport
+

Returns the local port number of the socket. Read-only option.

+
-remote ?address port?
+

Specifies or returns the remote hostname and port number. Can also be set using +udp_conf channel host port.

+
-peer
+

Returns the remote hostname and port number for the packet most recently +received by this socket. Read-only option.

+
-family
+

Returns whether socket is configured for IPv4 or IPv6. Read-only option.

+
-broadcast ?boolean?
+

Specifies or returns whether can listen and send on the broadcast address. For some systems +a flag must be set on the socket to use broadcast. This option is not permitted when +using IPv6, instead use multicast.

+
-ttl ?count?
+

The time-to-live is given as the number of router hops the packet may do. For +multicast packets this is important in specifying the distribution of the +packet. The system default for multicast is 1 which restricts the packet +to the local subnet. To permit packets to pass routers, you must increase the +ttl. A value of 31 should keep it within a site, while 255 is global.

+
-mcastadd groupaddr
+
+
-mcastadd "groupaddr netwif"
+
+
-mcastdrop groupaddr
+
+
-mcastdrop "groupaddr netwif"
+
+
-mcastgroups
+

tcludp sockets can support IPv4 and IPv6 multicast operations. To receive +multicast packets the application has to notify the operating system that +it should join a particular multicast group. For IPv4 these are specified as addresses +in the range 224.0.0.0 to 239.255.255.255.

+

When specifying only the groupaddr the system will determine the network interface to use. +Specifying the netwif will join a multicast group on a specific network interface. +This is useful on a multihomed system with multiple network interfaces. +On windows you must specify the network interface index. For other platforms the network +interface (e.g. 'eth0') name can be specified.

+

To view the current set of multicast groups for a channel use -mcastgroups

+
-mcastif
+

Returns which interface is used for outgoing multicast packets. UNIX only.

+
-mcastloop ?boolean?
+

With multicast udp the system can choose to receive packets that it has sent +or it can drop them. This is known as multicast loopback and can be controlled +using this option. By default the value is true and your application will receive +its own transmissions.

+
+
udp_peek channel ?buffersize?
+

Examine a packet without removing it from the buffer. Option buffersize specifies the +maximum buffer size. Value must be between 0 and 16.

+

This function is not available on windows.

+
::udp::build-info
+

Return information on the build environment.

+
::udp::getaddrinfo -hostname name ?optionName value ...?
+

Returns a list with info on the IP address matching the specified parameters. +Valid options are:

+
+
-hostname name
+

Specifies which IP address to use for lookup. Can use IP address or name. Required option.

+
-port number
+

Specifies which port number to use for lookup.

+
-service name
+

Specifies which well-known service (i.e. http, https, etc.) to use for port in lookup.

+
-ipv4
+

Only return IP v4 addresses.

+
-ipv6
+

Only return IP v6 addresses.

+
-server
+

Only return services for which hostname is a server.

+
-tcp
+

Only return TCP services.

+
-udp
+

Only return UDP services.

+
+
::udp::getnameinfo address ?ipv6?
+

::udp::getnameinfo will return the name(s) corresponding to IP +address address. With ipv6, address is an IPv6 address.

+
+
+

EXAMPLES

+
+# Send data to a remote UDP socket
+proc udp_puts {host port} {
+    set s [udp_open]
+    fconfigure $s -remote [list $host $port]
+    puts $s "Hello, World"
+    close $f
+}
+
+
+# A simple UDP server
+package require udp
+proc udpEventHandler {sock} {
+    set pkt [read $sock]
+    set peer [fconfigure $sock -peer]
+    puts "$peer: [string length $pkt] {$pkt}"
+    return
+}
+proc udp_listen {port} {
+    set srv [udp_open $port]
+    fconfigure $srv -buffering none -translation binary
+    fileevent $srv readable [list ::udpEventHandler $srv]
+    puts "Listening on udp port: [fconfigure $srv -myport]"
+    return $srv
+}
+set sock [udp_listen 53530]
+vwait forever
+close $sock
+
+
+# A multicast demo.
+proc udpEvent {chan} {
+    set data [read $chan]
+    set peer [fconfigure $chan -peer]
+    puts "$peer [string length $data] '$data'"
+    if {[string match "QUIT*" $data]} {
+        close $chan
+        set ::forever 1
+    }
+    return
+}
+set group 224.5.1.21
+set port  7771
+set s [udp_open $port]
+fconfigure $s -buffering none -blocking 0
+fconfigure $s -mcastadd $group -remote [list $group $port]
+fileevent $s readable [list udpEvent $s]
+puts -nonewline $s "hello, world"
+set ::forever 0
+vwait ::forever
+exit
+
+
+

HISTORY

+

Some of the code in this extension is copied from Michael Miller's tcludp +package. (http://www.neosoft.com/tcl/ftparchive/sorted/comm/tcludp-1.0/) +Compared with Michael's UDP extension, this extension provides Windows +support and provides the ability of using 'gets/puts' to read/write +the socket. In addition, it provides more configuration ability.

+

Enhancements to support binary data and to setup the package for the Tcl +Extension Architecture by Pat Thoyts.

+

Support for IPv6 and allowing a multicast join on a specific network interface is added by Huub Eikens.

+
+

See Also

+

socket

+
+

Keywords

+

I/O, IP Address, TclUDP, UDP, asynchronous I/O, bind, channel, connection, domain, host, name, network, network address, networking, socket, udp

+
+ +
diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/udp1013t.dll b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/udp1013t.dll new file mode 100644 index 00000000..11a3784f Binary files /dev/null and b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/tcludp1.0.13/udp1013t.dll differ diff --git a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/tcl9udp1012.dll b/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/tcl9udp1012.dll deleted file mode 100644 index b895ff99..00000000 Binary files a/src/vfs/punk9win_for_tkruntime.vfs/lib_tcl9/udp1.0.12/tcl9udp1012.dll and /dev/null differ