Dear Brice, is it possible that you try it now ?
We would be happy for more testers ;-) Please get the tcl trunk here: http://core.tcl.tk/tcl/zip/Tcl+Source+Code-04da25f2f5b8ce72.zip?uuid=04da25f2f5b8ce72c42f217d4e745d9c33fc8f70 (zip button on this page http://core.tcl.tk/tcl/info/04da25f2f5 ) or if you want tcl 8.5 (the upper is 8.5) : http://core.tcl.tk/tcl/info/f3fac8ede1 with its "download zip button": http://core.tcl.tk/tcl/zip/Tcl+Source+Code-f3fac8ede1a102da.zip?uuid=f3fac8ede1a102dac5bb6c3f4d13586bb93b98ab (use flag --enable-threads , as you had this before, otherwise you would not have the issue) Here is a log how to build tcl on 64 bit CentOS: http://wiki.tcl.tk/3298 Here is a installation log of Rivet: http://wiki.tcl.tk/3874 Best regards, Harald Am 17.08.2013 20:33, schrieb Brice Hamon: > Thanks Damon, > > I got it to work, using read -nonewline on a loop with a non blocking > socket. > > The fileevent command does not work as Massimo pointed it out. > > Can't wait for the official fix in TCL. > > Thanks all. > > Brice. > > > > > On Sat, Aug 17, 2013 at 1:21 PM, Damon Courtney <da...@tclhome.com > <mailto:da...@tclhome.com>> wrote: > > You can't do "puts -nonewline" on one side and then "gets" on the > other. It will hang forever waiting for the newline to come > through. That's what gets does. It reads up to the newline character. > > And since you didn't put the socket in non-blocking mode, the gets > will block, waiting forever for a newline that will never come. > Poor little gets. If you add -blocking 0, gets will return > immediately but with no data because it tried to get a line and > still never found a newline. > > If you don't want to use newlines, or you want to send binary data, > you need to use read to get at the data. It will read everything in > the buffer, and since you have -buffering none, that will be > everything you sent. The better idea would be to do this: > > fconfigure $s -buffering full > > puts -nonewline $s $data > flush $s > > Unless you're trying to stream something bit-by-bit, that will > buffer all your data (up to the size of the socket buffer), and then > flush will push it all out at once. > > But Massimo is right, your gets is waiting on a newline. > > D > > > On Aug 17, 2013, at 9:31 AM, Brice Hamon <normandvik...@gmail.com > <mailto:normandvik...@gmail.com>> wrote: > > > Hi all, > > > > I am facing a unexpected problem with such simple code in Rivet: > > I open a socket to an echo server, send something and wait for the > answer. > > > > I open the socket like that: > > > > set port 20445 > > set host "toto2" > > set s 0 > > > > proc connectToBs {} { > > ::request::global s > > ::request::global port > > ::request::global host > > > > set s [socket $host $port] > > puts "Connected to $host:$port" > > fconfigure $s -buffering none > > fconfigure $s -translation binary > > } > > > > Then: > > > > connectToBs > > puts -nonewline $s "OKOK" > > set resp {} > > gets $s resp <=== and I am getting stuck in the gets forever. > > > > The same code under a regular tclsh works. I don't get it. > > > > I am using the native TCL8.5.10 from SUSE 12.1 with Rivet 2.1.2. > > > > Any idea? > > > > Thanks, > > Brice. > > -- ELMICRON Dr. Harald Oehlmann GmbH Koesener Str. 85 06618 Naumburg Germany Phone: +49 (0)3445 78112-0 Fax: +49 (0)3445 78112-19 www.Elmicron.de German legal references: Geschaeftsfuehrer: Dr. Harald Oehlmann, Jens Oehlmann UST Nr. / VAT ID No.: DE206105272 HRB 212803 Stendal --------------------------------------------------------------------- To unsubscribe, e-mail: rivet-dev-unsubscr...@tcl.apache.org For additional commands, e-mail: rivet-dev-h...@tcl.apache.org