~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to unixport/tryserv.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
catch { close $server }  
 
2
proc jany { args } {
 
3
    global me ;
 
4
    set me [lindex $args 0] ;
 
5
    fconfigure $me -blocking 0 ;
 
6
    fileevent $me readable "joke $me"
 
7
}
 
8
 
 
9
proc joke { sock } {
 
10
    if { [eof $sock] } {
 
11
        puts "at end"
 
12
        close $sock
 
13
        return ""
 
14
    }
 
15
    set it [read $sock]
 
16
    puts "<$it>"
 
17
    return
 
18
}
 
19
 
 
20
set server [socket -server jany 4008]
 
21
 
 
22
proc send { s } { global me ;
 
23
                 puts $me $s ;
 
24
                 flush $me }
 
25
proc r { } {global me ; read $me }
 
26
 
 
27
 
 
28
 
 
29