Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help

Status
Not open for further replies.

karmell

Programmer
Feb 2, 2011
1
PL
Hi everyone, i have some favor could some one help me ?

i have

server.tcl


proc Echo_Server {port} {
global x
set s [socket -server EchoAccept $port]
vwait connected

}

proc EchoAccept {sock addr port} {
global echo

puts "Accept $sock from $addr port $port"
set echo(addr,$sock) [list $addr $port]

# Ensure that each "puts" by the server
# results in a network transmission

fconfigure $sock -buffering line

# Set up a callback for when the client sends data

fileevent $sock readable [list Echo $sock]


}
proc Echo {sock} {
global echo
if {[eof $sock] || [catch {gets $sock line}]} {
close $sock
puts "Close $echo(addr,$sock)"
unset echo(addr,$sock)
} else {
puts $sock $line
}
}


and i need to create some loop which shows me acctualy connected clients and show me all connections from beginning.
Can someone show me how to do this pls.
 
I'm not sure what you mean by "shows me". You don't seem to by using Tk and that's fine. In the global space, make a list:
set lstConnections {}

Then in EchoAccept, append the data you want to that list:
lappend ::lstConnections {$addr $port}

Then display that list:
puts $::lstConnections

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top