This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

check if socket is connected..

Old posts that have not been replied to for several years.
Locked
l
loze

Post by loze »

how do i check if $sock is connected.

set sock [socket soundic-radio.big.du.se 7778]

errors:
[14:43] couldn't open socket: connection refused
[14:43] TCL error in script for 'timer470':
p
ppslim
Revered One
Posts: 3914
Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England

Post by ppslim »

If the script throws a wobbler like that, then it failed to connect, else it worked.

Use the catch command to let the error occur, but let the script continue.

The catch command will return 1 if the command worked fine, on error it will return 0.
l
loze

Post by loze »

anything like this?

if {[catch {set sock [socket soundic-radio.big.du.se 7778]}] != 0} {


<font size=-1>[ This Message was edited by: loze on 2002-05-30 13:42 ]</font>
Locked