Author Topic: Network hub pinger redirect Manager  (Read 8659 times)

0 Members and 1 Guest are viewing this topic.

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
Network hub pinger redirect Manager
« on: 26 May, 2004, 19:40:44 »
Heya peeps ..

This script will ping each of the hubs in turn every 1 min.
if the hubs on line it is added to the list of online hubs.
the redirect of the hub is set to the next online hub in the list every min.
if offline  it is removed from the list untill the script sees it online again.

i curently run this script on its own hub because it locks the hub every time it pings.

and redirect users to it  who are then sent to the other hubs in the network


I hope it of some use ..



Code: [Select]


--============================================================
--========= Network hub pinger redirect Manager ==============
--============= By ??????Hawk?????? 25-05-04 =================
--============================================================
--=====This Script is designed to be run on its own hub ======
--======= Use another Ptokax hub on a different port =========
--============================================================
--========== +rdon = enable / +rdoff = disable ===============

--================== Editable settings =======================

sBot = "Network-Redirector-" --// Bot name
DefaultHub = "DefaultHub.no-ip.org:411" --// Default redirect hub Addy:Port
RedirectsEnabled = "true" --// true/false Auto start
mins = 1 --// Ping Next Hub after # mins
Hub_Adress = {
"Hub1.no-ip.com",
"411",
"Hub2.no-ip.org", --// Hubs In network
"415", --// you can add / remove as many as you want
"Hub3.servemp3.com", --// but keep the same layout
"412", --// hub  then port
"Hub4.no-ip.org",
"417",
"Hub5.servemp3.com",
"411",
"Hub6.no-ip.com",
"414",
"Hub7.no-ip.com",
"412",
 }

--=========  Mess With The Below at your own Peril ===========
Onlinehubs = {}
HubCounter = 1
curenthub = 1
curentport = 2
function Main()
hubcount = getn(Hub_Adress)
SetTimer(1000 * 60 * mins)
if RedirectsEnabled == "true" then
StartTimer()
end
end

function NewUserConnected(curUser)
if (RedirectsEnabled == "false") then
frmHub:SetRedirectAddress(DefaultHub)
end
SendToNick(curUser.sName, "<" ..sBot .."> Redirecting... |$ForceMove "..frmHub:GetRedirectAddress().."|")
end

function DataArrival(user, data)
  local data=strsub(data,1,strlen(data)-1)
local s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if cmd=="+rdon" then
SendToOps(sBot," Redirects enabled ")
StartTimer()
RedirectsEnabled = "true"
elseif cmd=="+rdoff" then
SendToOps(sBot," redirects disabled ")
  StopTimer()
  RedirectsEnabled = "false"
end
end

function OnTimer()
if curentport == hubcount + 2 then
curenthub = 1
curentport = 2
end
displayhub(curenthub,curentport)
curenthub = curenthub + 2
curentport = curenthub + 1

frmHub:SetRedirectAddress(Onlinehubs[HubCounter])
if (getn(Onlinehubs) == 0)  then
frmHub:SetRedirectAddress(DefaultHub)
end
if HubCounter == getn(Onlinehubs) then
HubCounter = 1
else
HubCounter = HubCounter + 1
end
CurrentOnlineHubs()
end

--============================================================
--===================! ! !  PING ! ! ! =======================

function displayhub(curenthub,curentport)
local a = connect(Hub_Adress[curenthub],Hub_Adress[curentport])
CurrentChecking = Hub_Adress[curenthub]..":"..Hub_Adress[curentport]
Active = "false"
ActiveHubCount = getn(Onlinehubs) + 1
for index, value in Onlinehubs do
if Onlinehubs[index] == CurrentChecking then
    Active = "true"
    Position = index
end
end
if a == nil then
if Active == "false" then
SendToOps(sBot,CurrentChecking.."   Hub is still Offline")
elseif Active == "true" then
SendToOps(sBot,CurrentChecking.."   Hub Has Gone Offline")
Onlinehubs[Position] = nil
end

else
if Active == "false" then
SendToOps(sBot,CurrentChecking.."   Has Come Online")
Onlinehubs[ActiveHubCount] = CurrentChecking
elseif Active == "true" then
SendToOps(sBot,CurrentChecking.."   Hub is still online")
end

a:close()
end
end

--============================================================
--===================! ! !  PONG ! ! ! =======================

function CurrentOnlineHubs()
local names = "\r\n\r\n-------------Curent Online Hubs----------------\r\n\r\n\t"
for index, value in Onlinehubs do
local line = index
names = names.." "..Onlinehubs[line].."\r\n\t"
end
names = names.."\r\n\r\nCurently Redirecting to "..frmHub:GetRedirectAddress().."\r\n\r\n"
SendToOps(sBot,names)
end

--===================== End Of Script ========================



Enjoy..

??????Hawk??????
« Last Edit: 26 May, 2004, 19:44:40 by ??????Hawk?????? »

PtokaX forum

Network hub pinger redirect Manager
« on: 26 May, 2004, 19:40:44 »

Offline Sudds

  • Fulll Member
  • ****
  • Posts: 71
  • Karma: +0/-0
(No subject)
« Reply #1 on: 29 May, 2004, 01:11:33 »
Looks good would be better if u could get rid of the locking bit. I have seen scripts like this befor and u can fix it so look around and u will be able to fix it. :D
Sudds

Offline stinger

  • Junior Member
  • **
  • Posts: 10
  • Karma: +0/-0
(No subject)
« Reply #2 on: 22 August, 2004, 22:53:19 »
Hi Hawk ;o)

I have no trouble with ur script.. but ur script has some troubles with me... Or my comp/conn. hehe...

we use ur script in our network, and it works fine on a comp without router. it can also redirredt to another hub on same comp.

but when we move it to run from my comp, then it cannot redirrect to my other hub on my comp..:

first, im behind a router and so i use LAN ip10.0.0.2:1413(i have several comp on 1 ip, that's why)

If i put in the lan ip in ur script it can find the other hub on my comp, but it tries to redirrect new users to the lan ip (10.0.0.2:1413) wich they cannot find, of caurse ;)  

If i put the normal used adress (xxx.dyndns.xx:1413)for the hub in ur script, then it cannot find the other hub and assumes it is offline..

so u see i'm in need for a better script that can find a hub on it's LAN IP (10.0.0.2:1413).. but will redirrect users to the adress (xxx.dyndns.xx:1413)

Can u help me on that one?? if u need more info, please tell me :D

Greeting
Stinger
« Last Edit: 22 August, 2004, 22:54:31 by stinger »

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #3 on: 22 August, 2004, 23:12:44 »
hi m8  .  


are you adding the  addy and port correctly  ??

Code: [Select]
"xxx.dyndns.xx",
"1413",

???

Offline stinger

  • Junior Member
  • **
  • Posts: 10
  • Karma: +0/-0
(No subject)
« Reply #4 on: 23 August, 2004, 19:20:50 »
Hi :o)
yes.. i doubbel-checked both address and port-nr...

when the arry was running on my, the other hubs, it should redirrect to, worked fine... only myb hub screw up.. and i've tried with both the address:port and Lan-IP:port for my other hub..

Problem.. the arry can find the other hub on Lan-IP:port but it sends THAT adress to users client..

ex: if u try to log on to our net, the arry will redirrect u to the address in it's script... if it says "xxx.dyndns.xx" in the script, it redirrects u to that adress... but in this case it cannot find my hub on that adress.. and says"hub still offline"it has to find it via LAN-IP:port...

so if i enter the LAN-IP:port in ur script, the arry finds the hub, and in main it says "hub is online" but but but.. since i've entered the LAN-IP:port to make the script find the hub it sends the LAN-IP:port to the user...

So if u logon to our arry it will try to redirrect u to LAN-IP:port... but what happens if u try to logon to 10.0.0.2????   nothing, unless u have ur ovn LAN and uses that same LAN-IP and same port... shuld be lucky if so.. but still.. u'll never get into my hub then...

the same as if u have a Local Net and try to connect to ur hub, u have to log on to it's LAN-IP in stead of it's address, or else it wont connect, right??


Did that help u?  really hope so...

Greetings
Stinger

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #5 on: 23 August, 2004, 21:31:17 »
hi m8..

sounds like youve got a setting wrong somwhere in your router/firewall..

im not too good and setting them up as i dont use one.

hopefully someone in here will be able to help..

maby this page will help you..

http://www.portforward.com/


??????Hawk??????
« Last Edit: 23 August, 2004, 21:31:39 by ??????Hawk?????? »

Offline stinger

  • Junior Member
  • **
  • Posts: 10
  • Karma: +0/-0
(No subject)
« Reply #6 on: 23 August, 2004, 22:19:42 »
hi (once again ;o)   )

i'm positive that my router+firewall is set up right.. (high thoughts i know *LOL*  )

i don't know hot to write any script yet but i have an idea what i'm looking for in ur script.
Something like this:

first: make a edit part for redirrect address, the same way as already exists for the "find hub"part in the start of the script. So that the new editing part is next to/right below (to make things easier for me newbie ;o)

then if it is possible to make something like this:


if "hubaddress-1" is found online    then set redirrect for that hub to "redirrect address-1"

if "hubaddress-2" is found online    then set redirrect for that hub to "redirrect address-2"

etc etc

that way it should be able find a hub on one adr. but send the users to another adr.

Just to bother u even more... is it possible to add a !command, that can be typed in main, to add or remove hubs from the script?? so that it can be "remote controlled" if arrey-owner i on the road and another Net-OP has to make changes? maby also a !cmd to restart or start/stop script?

hope i'm not to annoying

Greetings
Stinger
« Last Edit: 23 August, 2004, 23:41:46 by stinger »

Offline Boostland

  • Junior Member
  • **
  • Posts: 19
  • Karma: +0/-0
(No subject)
« Reply #7 on: 07 September, 2004, 17:14:10 »
Try setting your router so it responds to external pings, I did it to mine and found that it would let my connect to a hub that I host using my no-ip address, when it was disabled I could only connect via my internal lan ip.

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #8 on: 07 September, 2004, 20:23:37 »
heya  peeps  ..

well ive  tried and  further tried to  use the  windows pinger instead of using a Ptokax port to show online hubs..

the problem is  the ping.exe  will tell you if an ip is online  but cant tell me if the hub is running..

so im afraid  unless someone with a better scripting knowledge can come up with another way ...  Im Beat..


Hawk

Offline [PT]CableGuy

  • Forum Ace
  • *****
  • Posts: 98
  • Karma: +1/-0
(No subject)
« Reply #9 on: 07 September, 2004, 21:19:15 »
Hi there Stinger:

1st - Are you saying that when i ping xxx.dyndns.xx , it will not give "you're IP" given by you're ISP ?
2nd - If you want to hubs in the same connection using a router , you need to open the ports used by the hubs and redirect each one to "their" hub pc.
3rd - What router do you have and what is the link to "this hubs"...?

I don't know this script but if others are saying the script work for them...then ,it's probably a connection problem.
I can help you setting up you're router , if you need just PM me. :]

Offline Psycho_Chihuahua

  • Systemspecialist IT
  • Emperor
  • **
  • Posts: 1 054
  • Karma: +112/-1
  • I am wherever i want to be
    • PtokaX Luaboard
(No subject)
« Reply #10 on: 08 September, 2004, 18:04:07 »
Gr8 Script Hawk

Just one Question:

What would i have to change in the script to do this:

Hub 1 - Redirect Hub

Hub 2 - Standard Hub (would need to be connected in the normal occasion)

Hub 3 - Backup Hub, for when Hub 2 has a problem or goes offline


In other words the Backup Hub should only be connected if the MAIN Hub (Here Hub 2) goes Offline due to Network probs or whatever.

Hope you can help me here

thnx alot in advance
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #11 on: 08 September, 2004, 18:40:35 »
hi m8  ..


just to confirm ..

you mean if the hub set in here
Code: [Select]
DefaultHub = "DefaultHub.no-ip.org:411" --// Default redirect hub Addy:Port

goes offline  it would default to another hub  if all others were offline  ????



or

do you mean..

if hub1 is offline  it would redirect to  another hub " hub1A "
and  if  hub2 is offline it would redirect to " hub2A "

etc..etc.   ?????


??????Hawk??????

Offline Psycho_Chihuahua

  • Systemspecialist IT
  • Emperor
  • **
  • Posts: 1 054
  • Karma: +112/-1
  • I am wherever i want to be
    • PtokaX Luaboard
(No subject)
« Reply #12 on: 08 September, 2004, 19:08:07 »
almost what i meant ;) sorry my english is appauling atm.

what i exactly mean is this:

Hub 1 - this is the Hub using your script

Hub 2 - This is my Main Hub and should stay the Main Redirect Adress at all Times exept when Offline or not available

Hub 3 - This is my Backup Hub for the occasional Server Breakdown where my Main Hub is running.

So Hub 2 should stay the Main Redirect Adress for as long as it' Online. But if it should go Offline, then (and only then) should the Redirect go to the Backup Hub.

hope it's a little clearer now *fg
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #13 on: 08 September, 2004, 19:14:05 »
hi m8  ..  

have you tried setting it like this  ....


Code: [Select]
DefaultHub = "BackupHub.no-ip.org:411" --// Backup redirect hub Addy:Port
RedirectsEnabled = "true" --// true/false Auto start
mins = 5 --// Ping Next Hub after # mins
Hub_Adress = {
"MainRedirectTo.no-ip.com",         --// Permanent redirect addy
"411",
}
--=========  Mess With The Below at your own Peril ===========

******Edit
No need to appologise for bad english, it is a world wide board.. :-)

« Last Edit: 08 September, 2004, 19:19:19 by ??????Hawk?????? »

Offline Psycho_Chihuahua

  • Systemspecialist IT
  • Emperor
  • **
  • Posts: 1 054
  • Karma: +112/-1
  • I am wherever i want to be
    • PtokaX Luaboard
(No subject)
« Reply #14 on: 08 September, 2004, 19:27:29 »
oh, didnt know that works lol thnx for the Info

Well about my english....i am in fact british but living in switzerland since 1987 has done wonders to my mother tongue *fg
PtokaxWiki ?PtokaX Mirror + latest Libs

01100001011011000111001101101111001000000110101101101110011011110111011101101110001000000110000101110011001000000101010001101111011010110110111101101100011011110111001101101000

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #15 on: 08 September, 2004, 19:36:13 »
y/w  m8



??????Hawk??????

Offline [KATZ]ice

  • Junior Member
  • **
  • Posts: 24
  • Karma: +0/-0
(No subject)
« Reply #16 on: 22 February, 2005, 12:53:17 »
hey, your script is really cool, works pretty great, only i'm getting this error:

after about a day or so of running (each time different), the redirect becomes stuck at a single adress, it just keeps redirecting to that one, restarting the script solves that, but i can't do that all the time, as the thing runs on a deticated pc, not on my own. and it should have enough performance....

1,8 GHZ + 256 MB Ram, Redirect hub, 300 user hub

Shouldn't be that right?

i got this settings:

Code: [Select]
sBot = "###################" --// Bot name
DefaultHub = "########.no-ip.info:411" --// Default redirect hub Addy:Port
RedirectsEnabled = "true" --// true/false Auto start
mins = 0.083333 --// Ping Next Hub after # mins
Hub_Adress = {
"#########.no-ip.info", --// Hubs In network
"411", --// you can add / remove as many as you want
"#########.no-ip.info", --// but keep the same layout
"411", --// hub then port
"#########.no-ip.info",
"411",
"#########.no-ip.info",
"411",
"#########.no-ip.info",
"411",
"#########.no-ip.info",
"413",
}
 

what am i doing wrong?

Cheers ICE

Offline [KATZ]ice

  • Junior Member
  • **
  • Posts: 24
  • Karma: +0/-0
(No subject)
« Reply #17 on: 26 February, 2005, 17:35:44 »
ok, changed the ping interval to 1 min, still have the problem, but it take longer to happen. after a while it just gets stuck at a redirect adress, and it just keeps redirecting to that one.

Cheers Daan

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #18 on: 26 February, 2005, 17:42:52 »
hi m8  ...

yes  i  did come  across  this  problem  but  stopped  developement of this script when i moved it all over to my GUI for  Xsthetic Netserver...

i will have another look at is  when i  Convert all my collection over to  LUA 5


but for now  set up some trused users as Master in that hub and Give them the  Option to  restart script with the   !restartscripts  command..

and if they see it  stuck  they can remotly restart it  :))  :))  :))

OR  move over to  Xsthetic Netserver and Have your GUI/LiNK  controll the redirect addy of your hub and use your hub to distribute the users..


Cheers



??????Hawk??????

Offline I_Am_Canadian

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
(No subject)
« Reply #19 on: 09 July, 2005, 06:25:58 »
is there anyway to change this so it sends to a certien hub via min share instead of just hubcount

Offline ??????Hawk??????

  • Emperor
  • **
  • Posts: 1 044
  • Karma: +12/-2
    • Leeds Laptop Repairs
(No subject)
« Reply #20 on: 10 July, 2005, 03:03:13 »
Quote
Originally posted by I_Am_Canadian
is there anyway to change this so it sends to a certien hub via min share instead of just hubcount

Hi m8  

this script is Usless now as the Newer versions of Ptokax dont support LUA sockets...


My Terminator script will give you this by using the Chat/Hub link feature with " GUI Controled redirects " Enabled..


Have fun

??????Hawk??????

Offline I_Am_Canadian

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
(No subject)
« Reply #21 on: 10 July, 2005, 03:05:30 »
am using td4 and the script works fine with it.

Offline Mikey

  • Fulll Member
  • ****
  • Posts: 66
  • Karma: +3/-0
    • Friends Unlimited Network
Re: Network hub pinger redirect Manager
« Reply #22 on: 10 March, 2006, 03:19:48 »
Ok Hawk need some help with this. I got the script to ping the hubs and it tells if there online or offline but how do u get the offline hubs to redirect elsewhere?
Mikey

**Friends Unlimited Network**
    Network Founder

Offline Mikey

  • Fulll Member
  • ****
  • Posts: 66
  • Karma: +3/-0
    • Friends Unlimited Network
Re: Network hub pinger redirect Manager
« Reply #23 on: 10 March, 2006, 04:45:14 »
ok i got the redirect portion working thanks anyways
Mikey

**Friends Unlimited Network**
    Network Founder

PtokaX forum

Re: Network hub pinger redirect Manager
« Reply #23 on: 10 March, 2006, 04:45:14 »