mIRC Home    About    Download    Register    News    Help

Print Thread
#71449 15/02/04 08:05 AM
Joined: Jan 2003
Posts: 109
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
Hi

I use a number of scripts that retrieve website news/data for a channel. Sometimes either due to internet lag/timeouts etc a sock is still open by the time the script is next run:
e.g.
* /sockopen: 'djgen' socket in use (line 199, Newsroom.txt)

so I either have to /sockclose manually or wait for the connection to come right - is there a way to automatically close the socket if the above /sockopen occurs?

Thanks in advance...

#71450 15/02/04 08:14 AM
Joined: Dec 2002
Posts: 3,015
C
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,015
I don't think you can detect that event, but you can see if the socket is open before trying to open it, e.g:
Code:
if ( $sock(djgen) ) {
  sockclose djgen
}
sockopen djgen ...

#71451 15/02/04 08:23 AM
Joined: Jan 2003
Posts: 109
S
Vogon poet
OP Offline
Vogon poet
S
Joined: Jan 2003
Posts: 109
thanks Collective - will give that a try...

#71452 15/02/04 09:07 AM
Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Btw, there's no need for the $sock() check - he could merely do:
  • sockclose name
    sockopen name addy port
A nice thing about /sockclose is that it already does an internal check and doesn't display an error if you're trying to close a nonexistent socket. Something similar to /.remove filename. I would like to see /hfree and /comclose working in the same way...


Link Copied to Clipboard