Network hub pinger redirect Manager
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

Network hub pinger redirect Manager

Started by ??????Hawk??????, 26 May, 2004, 19:40:44

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

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

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 ..



--============================================================
--========= 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??????

Sudds

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

stinger

#2
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

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

hi m8  .  


are you adding the  addy and port correctly  ??

"xxx.dyndns.xx", 
"1413",

???

stinger

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

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

#5
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??????

stinger

#6
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

Boostland

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.

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

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

[PT]CableGuy

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. :]

Psycho_Chihuahua

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

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

hi m8  ..


just to confirm ..

you mean if the hub set in here
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??????

Psycho_Chihuahua

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

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

#13
hi m8  ..  

have you tried setting it like this  ....


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.. :-)


Psycho_Chihuahua

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

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

y/w  m8



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

[KATZ]ice

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:

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

[KATZ]ice

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

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

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??????

I_Am_Canadian

is there anyway to change this so it sends to a certien hub via min share instead of just hubcount

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

QuoteOriginally 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??????

I_Am_Canadian

am using td4 and the script works fine with it.

Mikey

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

Mikey

ok i got the redirect portion working thanks anyways
Mikey

**Friends Unlimited Network**
    Network Founder

SMF spam blocked by CleanTalk