Is you echo server returning the data without buffering or line termination? 
IIRC good old echo available on port 6 (?) required a newline, isn't it?

 -- Massimo
 
Inviato dal mio BlackBerry®

-----Original Message-----
From: Brice Hamon <[email protected]>
Date: Sat, 17 Aug 2013 10:31:17 
To: [email protected]<[email protected]>
Subject: Socket gets hanging in Rivet

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.

Reply via email to