Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language

Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

TCL(Tool Command Language) Scripting

Basic TCl UDP doubt?

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


# Select a subnet and the port number.
set subnet
set port   7767

# 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


Hi, Can someone please explain the execution sequence of this code..
It is meant to braodcast message.

On May 14, 2:24 pm, Aman <ama@gmail.com> wrote:

The fileevent and proc take care of incoming packets; guess you don't
need help for this part.
The writing part prepares for broadcast (fconfigure -broadcast 1 -
remote ...), and the actual packet sending occurs in the puts
(immediately because of -buffering none).

Only this won't work because your broadcast address rather looks like
a netmask ;-)


On May 15, 3:18 am, Alexandre Ferrieux <alexandre.ferri@gmail.com>

Thanks a ton Man..


Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc