mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: May 2020
Posts: 19
K
Kendy Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: May 2020
Posts: 19
Hello there.Everybody can see this code and design more to help me when the server notified "Unable connect to server" 3 times, it will automatically disconnect to automatically switch to another ip proxy in the file proxylist.txt to connect continue. server, so on until the connection to the server is ok:

[20:34] * Disconnected
-
* Firewall is on Socks5 (134.209.100.103 62468)
-
[20:34] * Connecting to irc7.davang.org (6667)
-
[20:34] * Unable to connect to server (Connection attempt timed out)
-
[20:34] * Connect retry # 1 irc7.davang.org (6667)
-
[20:35] * Unable to connect to server (Connection attempt timed out)
-
[20:35] * Connect retry # 2 irc7.davang.org (6667)
-
[20:35] * Unable to connect to server (Connection attempt timed out)

Here is my code snippet:

on *:DISCONNECT: {
if (!%proxynum) { set %proxynum 2 }
else { inc %proxynum }
var %proxyinfo = $read(proxylist.txt, %proxynum)
; proxy connection code goes here
/firewall on $read(proxylist.txt, %proxynum)
}

Thank you very much and look forward to receiving your help soon!

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I haven't found an event which triggers when an individual retry fails. The only one I've seen is something like this:

on *:CONNECTFAIL: {
echo -s event $event server $server servertarget $servertarget serverip $serverip port $port network $network / (1-) $1-
}

but this doesn't trigger if the number of retries is not yet reached, which would force you to set the number of retries to something very low, which would force you to have the CONNECTFAIL event contain the /server command to join the server again. The other way would be a timer that gets launched during ON DISCONNECT which would use /filter or some other means to inspect the last few lines of the status window to look for a line containing the 'unable to connect' message, comparing the timestamp to see if it's newer.

Something else you should do with your handling of your text file is to check if the value is $null which means you've read past the last line of the file. You should also be in the habit of ALWAYS using the nt switches with $read unless you specifically want the 1st line of the file to be used as if it's a number containing the number of lines in the file, and unless you specifically want to spend extra CPU time checking the line for $identifier and %variable words to be evaluated. Something like:

if (!%proxynum) { set %proxynum 1 }
:label
inc %proxynum
var %proxyinfo = $read(proxylist.txt, %proxynum)
if (%proxyinfo == $null) { set %proxylist 1 | goto label }
; proxy connection code goes here
/firewall on $read(proxylist.txt,nt, %proxynum)

I don't know what your text looks like, but as you wrote it the 1st line was something that was not to be used. If that's not the case, the 1st line should be changed to 0 instead of 1.

Joined: May 2020
Posts: 19
K
Kendy Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: May 2020
Posts: 19
Marron:
proxylist.txt like this:

61.41.9.213 1081
51.144.228.148 1080
134.209.100.103 62468
184.176.166.8 17864
43.224.10.5 9999
185.161.211.25 9050
157.230.154.241 9050
136.244.76.121 30284
150.129.201.30 6667

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
It looks like
/help /proxy
gives advice on how to set proxy using a script instead of using the options menu. I'm not going to try to use a proxy because "reasons".
Also, the /help description of the proxy command indicates that "userid" and "password" are REQUIRED fields,

Do you know which proxy you're using by having your $ip changed to match the proxy IP?
i.e. when you use: //echo -a $ip
does that change to match the proxy you're using? If so, it should be easy to modify your script to compare the active proxy against the list, so it won't retry the same one.
Is using socks4/socks5/proxy supposed to be your choice, or does the proxy server require you to use one of those 3 settings which they prefer?

Joined: May 2020
Posts: 19
K
Kendy Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: May 2020
Posts: 19
Thanks for your enthusiastic help, I have asked the writer to help me complete the code. The bot will automatically connect with another Ip Poroxy if after 30 seconds without connecting to the server with the current Ip proxy, it will automatically switch to another Ip to continue connecting to the server.
Are you good at writing socket code from mirc to website domain, maroon?

Joined: Jan 2004
Posts: 2,127
Hoopy frood
Offline
Hoopy frood
Joined: Jan 2004
Posts: 2,127
I have trouble reading it, i've never tried to write it

Joined: May 2020
Posts: 19
K
Kendy Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: May 2020
Posts: 19
I have many ideas related to socket websites, but I haven't found anyone who is good at this. Do you know anyone on this forum who is good at writing Mirc for sockets?

Last edited by Kendy; 11/07/20 01:42 AM.

Link Copied to Clipboard