TCP Example

Client:


At startup:

set h [new TCPClientHandler]

open the connection:

set c [new TCPClientChannel]
$c open $addr $port
$h channel $c

# Do this to set the callback through a call like h->manager(this)
$session client-channel $h   

end the connection

set c [$h channel]
$h reset
delete $c

Server:


At startup:

set h [new TCPServerHandler]
# Do this to set the callback through a call like h->manager(this)
$session server-handler $h
set c [new TCPServerChannel]
$c open $server_port
$h channel $c

At the end of each service:

$h reset