mIRC Home    About    Download    Register    News    Help

Print Thread
#222601 26/06/10 01:34 AM
Joined: Jul 2006
Posts: 4,185
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,185
I think having a switch that automatically close a connexion before trying to open it for /sockopen would be a good idea, same for /socklisten


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Sep 2009
Posts: 52
Z
ziv Offline
Babel fish
Offline
Babel fish
Z
Joined: Sep 2009
Posts: 52
How about:

Code:
alias sockopen {
  if $left($1,1) == - && $sock($2) != $null sockclose $2 | sockopen $1-
  elseif $sock($1) != $null sockclose $1 | sockopen $1-
}

alias socklisten {
  if $left($1,1) == - && $sock($2) != $null sockclose $2 | socklisten $1-
  elseif $sock($1) != $null sockclose $1 | socklisten $1-
}


That would make sure whenever you try to open an existing sock, that sock will be closed first, then opened-anew.

Good luck,
ziv.

Joined: Jul 2006
Posts: 4,185
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,185
Yeah, and almost anyone could write is own code for the suggestion he is making, the point is that this one is over-used, I'm pretty sure that 99% of the time, people just do /sockclose name | sockopen name ip port, which is fine, but it would make a lot of sense to have this built-in


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I always thought that a socket would close by itself when its task was completed.

Joined: Jul 2006
Posts: 4,185
W
Wims Offline OP
Hoopy frood
OP Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,185
Well, a socket never close itself afaik, it's either you or the person you're connected to that close it, but I guess losing the internet connexion is also a way.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2004
Posts: 842
Hoopy frood
Offline
Hoopy frood
Joined: Nov 2004
Posts: 842
I second this.


What do you do at the end of the world? Are you busy? Will you save us?
Joined: Jul 2007
Posts: 1,129
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: Wims
I guess losing the internet connexion is also a way.
You never lose your sense of whimsicality :P


Link Copied to Clipboard