ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> tcljava-user
tcljava-user
[tcljava-user] fileevent and sockets in jacl
by Marc Ziegenhagen other posts by this author
Mar 23 2006 7:48AM messages near this date
Re: [tcljava-user] loading .so in Tcl that is created from Java | Re: [tcljava-user] fileevent and sockets in jacl
Hallo

Are the commands socket and fileevent now full work in the 
newest release?
I have a little test script with fileevent and server socket and it does not 
work correct. I become the following message when I make a connection from a 
telnet to this script:

proc Start_Server {port} {
	global Server

	set Server(main) [socket -server Accept $port]
}

proc Accept {sock addr port} {
	global Clients

	puts "Accept $sock from $addr port $port"
	set Clients(addr,$sock) [list $addr $port]
	fconfigure $sock -buffering line
	fileevent $sock readable [list ClientEvent $sock]
}

proc ClientEvent {sock} {
	global Clients

	if {[eof $sock] || [catch {gets $sock line}]} {
		# end of file or abnormal connection drop
		close $sock
		puts "Close $sock from [lindex $Clients(addr,$sock) 0] port			[lindex $Clients(addr,$sock)
 1]"
		catch {unset echo(addr,$sock)}
	} else {
		if {[string length $line]} {
			puts "Data from $sock:$line"
			puts $sock $line
			flush $sock
		}
	}
}

---------------message:
Start_Server 40666
set Run 1
puts "Started at [clock format [clock seconds] -format "%Y%m%d-%H%M%S"]"
vwait Run
puts "Stopped at [clock format [clock seconds] -format "%Y%m%d-%H%M%S"]"


Started at 20060323-151326
Accept sock1 from 127.0.0.1 port 51679
tcl.lang.TclException
        at tcl.lang.ReturnCmd.cmdProc(ReturnCmd.java:99)
        at tcl.lang.Parser.evalObjv(Parser.java:818)
        at tcl.lang.Parser.eval2(Parser.java:1221)
        at tcl.lang.Procedure.cmdProc(Procedure.java:161)
        at tcl.lang.Parser.evalObjv(Parser.java:818)
        at tcl.lang.Parser.evalObjv(Parser.java:804)
        at tcl.lang.Parser.eval2(Parser.java:1221)
        at tcl.lang.Procedure.cmdProc(Procedure.java:161)
        at tcl.lang.Parser.evalObjv(Parser.java:818)
        at tcl.lang.Parser.eval2(Parser.java:1221)
        at tcl.lang.Interp.eval(Interp.java:2222)
        at tcl.lang.Interp.eval(Interp.java:2306)
        at 
tcl.lang.SocketConnectionEvent.processEvent(SocketConnectionEvent.java:31)
        at tcl.lang.Notifier.serviceEvent(Notifier.java:444)
        at tcl.lang.Notifier.doOneEvent(Notifier.java:585)
        at tcl.lang.VwaitCmd.cmdProc(VwaitCmd.java:59)
        at tcl.lang.AutoloadStub.cmdProc(Extension.java:144)
        at tcl.lang.Parser.evalObjv(Parser.java:818)
        at tcl.lang.Parser.eval2(Parser.java:1221)
        at tcl.lang.Interp.eval(Interp.java:2222)
        at tcl.lang.Interp.evalFile(Interp.java:2401)
        at tcl.lang.SourceCmd.cmdProc(SourceCmd.java:75)
        at tcl.lang.Parser.evalObjv(Parser.java:818)
        at tcl.lang.Parser.eval2(Parser.java:1221)
        at tcl.lang.Interp.eval(Interp.java:2222)
        at tcl.lang.Interp.eval(Interp.java:2306)
        at tcl.lang.Interp.recordAndEval(Interp.java:2361)
        at tcl.lang.ConsoleThread$1.processEvent(Shell.java:321)
        at tcl.lang.Notifier.serviceEvent(Notifier.java:444)
        at tcl.lang.Notifier.doOneEvent(Notifier.java:585)
        at tcl.lang.Shell.main(Shell.java:151)

Thanks and bye
Marc Ziegenhagen

-- 
Marc Ziegenhagen
Panorgan AG
Pfannenstilstrasse 3
Postfach 470
CH-8820 Wädenswil
Tel.  +41 44 783 96 61
Fax.  +41 44 783 96 69
Email mz@[...].ch
Web   http://www.panorgan.ch	


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd_______________________________________________
tcljava-user mailing list
tcljava-user@[...].net
https://lists.sourceforge.net/lists/listinfo/tcljava-user
Thread:
Marc Ziegenhagen
Mo DeJong
Rob Ratcliff
Marc Ziegenhagen
Bruce Johnson
Tom Poindexter
Maurice Diamantini

Privacy Policy | Email Opt-out | Feedback | Syndication
© 2004 ActiveState, a division of Sophos All rights reserved