| Michiel 2004-07-28, 9:08 pm |
| Hi,
I've been trying and trying but can't get things working like i want to.
I'm trying to get my script connected to a FTP server using a
nonblocking and nonbuffered socket. At the moment I use a while
statement to fetch the data from the socket as it comes in. This works
just fine but the problem is that my script simply comes to a dead end
when the server stops sending data. I need some kind of timer which
'sees' that the server does not send any data and then aborts the while
statement.
while { ![eof $site(control_socket)] } {
if { [gets $site(control_socket) buf] < 0 } {
continue
}
puts $buf
}
My question is; how can I tell the while statement to stop if the server
does not send any data? (e.g. [gets $site(control_socket) buf] gives
me -1 for more than 100 milliseconds in a row)
Thank you for you help,
-Michiel
|