cvanmeer Halfop
Joined: 02 Dec 2003 Posts: 40 Location: The Netherlands
|
Posted: Thu Jan 08, 2004 1:43 pm Post subject: Bot crashing when getting no response using a TCL script |
|
|
Hi all,
I have a bit of a problem, I hope you can give me some directions.
I have the following code:
| Code: | proc sendstart {nick host hand chan text} {
global server port
set s [ socket $server $port]
puts $s "$text"
flush $s
set line [gets $s]
putquick "PRIVMSG $chan :$line"
} |
This will send the input the user gives after !send (ie. !send version) and it would return some info he get's from the server.
But the problem is this. If the other server I connect to is not available, or the service isn't returning anything, my bot times out and crashes. Is there a way to prevent this? I though of using a timer and check after 5 seconds, if there is no result, return with "Problem with service"
But I don't know how to do this
Anyone got some suggestions?
Thankx,
Chrizz |
|