Posted to tcl by aku at Fri May 17 16:27:17 GMT 2013view raw
- socket -server answer $port
- proc answer {socketChannel hostremote portremote} {
- # Block access from the outside. Accept only local system and
- # local LAN.
- if {![string match 192.168.193.* $hostremote] &&
- ![string match 127.0.0.* $hostremote]} {
- puts "rejected $hostremote/$portremote"
- close $socketChannel
- return
- }
- puts "accepted $hostremote/$portremote"
- #puts $hostremote
- #puts [fconfigure $socketChannel]
- fileevent $socketChannel readable [list readIt $socketChannel]
- }