mIRC Home    About    Download    Register    News    Help

Print Thread
Page 2 of 2 1 2
Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
I disagree, but if that's how you perceived it, fine. Let's leave it at that, I really am not interested in a flamewar.

Edit: and can you please stop adding text to your posts all the time? It really makes it very hard for me to reply to the points you make in a coherent way.

Last edited by Sat; 23/11/05 03:44 PM.
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
I understand your point about the edits, it's indeed probably annoying, but what's the purpose of an edit feature?

To conclude this discussion, when someone tells me "sure you could.... but good luck with ..." that basically means: "yes, you could use that, but it still stinks as a solution". That's not just my interpretation, that's a quite common way of saying something stinks. And I don't like being said my code sucks when I take the time to try to help another person, with no benefit for my own really.

<Timmy> I still haven't rented a Halloween suit.
<Jon> Don't worry about it, just pick one up the night before Halloween.
<Sat> Sure you could do that, but good luck finding anything decent right before Halloween.

Sat means: your proposal sucks, buddy.


Gone.
Joined: Nov 2003
Posts: 32
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Nov 2003
Posts: 32
Hey... u 2... stop it now! laugh make peace and stay calm :tongue:
thanks to you now I post a simple code to get in mirc the result of a ICMP ping:

alias icmp {
var %wsh = wsh $+ $ticks
.comopen %wsh wscript.shell
.comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c ping $1 >ping.txt,uint,0,bool,true)
echo -a * $read(ping.txt,$calc($lines(ping.txt) - 2))
.remove ping.txt
}

Simply digit /icmp www.google.com
Now it works, but maybe i can add a little control to give as result $true if the server has replied a packet or more, or $false if the hostneme has not replyed at all. Suggestions, comments r wellcome smile
THANKS U GUYS smile

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Quote:
To conclude this discussion, when someone tells me "sure you could.... but good luck with ..." that basically means: "yes, you could use that, but it still stinks as a solution". That's not just my interpretation, that's a quite common way of saying something stinks.

Perhaps we're dealing with small cultural differences here, because this is simply not true where I live.. the "good luck" construction is just a sarcastic way of presenting a downside which, if not applicable in the current situation (e.g. Jon knows this shop that always has nice suits left, or sazeMaster does not need the script to work anywhere else), does not invalidate the proposal as a whole.


Saturn, QuakeNet staff
Joined: Nov 2003
Posts: 32
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Nov 2003
Posts: 32
ok........

Here I am with the ended code. This code does not needs dll and is fast enough for my purposes. It is a simple alias that return $true if the hostname/ip replies to the ping, and $false if not.

Code:
alias icmp {
  var %t = $ticks
  var %wsh = wsh $+ %t
  .comopen %wsh wscript.shell
  .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c ping $1 &gt;ping $+ %t $+ .txt,uint,0,bool,true)
  var %res = $read(ping $+ %t $+ .txt,$calc($lines(ping $+ %t $+ .txt) - 2))
  var %r = $iif($remove($gettok(%res,$calc($numtok(%res,32) - 1),32),$chr(40),$chr(37)) &lt; 100,$true,$false)
  .remove ping $+ %t $+ .txt
  return %r
}


Ok, to use this script, simply put it in your remotes and where u want to use it (i.e. an alias called "test"), simply write somtin' like this:

Code:
alias test {
  icmp www.google.com
  echo -a * $result
}


Very very simple smile
U have to wait from 1 to 20 seconds to get the result, it is normal ^__^

Thanks u guys, really smile

Joined: Nov 2003
Posts: 32
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Nov 2003
Posts: 32
Hey do u have idea of why this strange thing happens?
If i make a ping (even from cmd -> ping) to www.google.com it works, but to www.190.it or www.virgilio.it or www.rossoalice.it they all seems doesn't responds to the ping request... why? Their sites are all up frown

Joined: Apr 2004
Posts: 871
Sat Offline
Hoopy frood
Offline
Hoopy frood
Joined: Apr 2004
Posts: 871
Their firewalls block ICMP PING packets, apparently..


Saturn, QuakeNet staff
Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
If all you want to do is know if a site is up, and get the ip, then why don't you just open a socket, and close it immediately when the sockopen event triggers, storing the ip property from $sock?

Or if you just want to get the ip, and see if the site exists, why not just /dns <url> and catch the results with the on dns event.

My point is, does it really need to be a ping? Because your icmp alias only wants to see if the host exists or not, so you could use other/easier methods, as the ones mentioned above.


Gone.
Joined: Nov 2003
Posts: 32
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Nov 2003
Posts: 32
Quote:
If all you want to do is know if a site is up, and get the ip, then why don't you just open a socket, and close it immediately when the sockopen event triggers, storing the ip property from $sock?

Or if you just want to get the ip, and see if the site exists, why not just /dns <url> and catch the results with the on dns event.

My point is, does it really need to be a ping? Because your icmp alias only wants to see if the host exists or not, so you could use other/easier methods, as the ones mentioned above.


God, open 3 or 4 socks every 5 or 10 second would be muuuuuuuuuuuuuuuuuuuuuuuch more dispendious, there is no comparison to me. smirk

Joined: Feb 2004
Posts: 2,019
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2004
Posts: 2,019
Actually, it would be much more efficient/faster than what you are currently using. This is because you don't actually have to send/receive any data. You just open the socket, and close it as soon as it opened. $sockerr will be filled if the host doesn't exist.

Btw, you should specify some of the flags when using ping.exe, like -n 1, that will make it much faster, as the default is 4 echo requests that are sent.

/checkhost <url>

Code:
alias checkhost sockopen checkhost $+ $ticks $$1 80
[color:red]  [/color] 
on *:sockopen:checkhost*:{
  echo -a $iif($sockerr,$false,$true - $sock($sockname).ip)
  sockclose $sockname
}

I am far from any sort of network/internet expert, but I think this will suffice for your specific problem.


Gone.
Joined: Nov 2003
Posts: 32
S
Ameglian cow
OP Offline
Ameglian cow
S
Joined: Nov 2003
Posts: 32
very nice idea.. i was thinkin' about using ICMP for his nature.. unconsidering that some ISP block that protocol (maybe for protecting themselves from ping DoS?).. it is strange that a such small, speedy, useful protocol, is blocked.. ppl like me has to find other ways to do our stuff laugh
Thanks a lot!!

Joined: Jan 2006
Posts: 7
B
Nutrimatic drinks dispenser
Offline
Nutrimatic drinks dispenser
B
Joined: Jan 2006
Posts: 7
Code:
alias checkhost sockopen checkhost $+ $ticks $$1 80

on *:sockopen:checkhost*:{

  echo -a $iif($sockerr,$false,$true - $sock($sockname).ip)

  sockclose $sockname
}

Hey I'm tottally lost here.. I'm trying to figure out a way where I can ping the certain ip/port into the channel for everyone to see rather than using echo -a. Does anyone have an idea? I already tried displying it by $chan or $nick. I'd like to make it where it where you can tell which servers are up or down to others by $nick. But by using the on TEXT action instead.

Sorta like this?

;; Message the channel to tell it whether it's true or false....
on 1:Text:*!serverstatus*:*:{ }

Example:

<me>!serverstatus
<bot> msg $nick Servers Servers Currently Up
<bot> .timer 1 3 msg $nick Kastien: IP: 127.0.0.1 Port: 7777
<bot> .timer 1 5 msg $nick Titan: IP: 127.0.0.1 Port: 7777
<bot> .timer 1 5 msg $nick ETC: IP: 127.0.0.1 Port: 7777

Can any of you please help me on this? it would be highly appreciated

Last edited by brethren; 12/01/06 07:18 PM.
Page 2 of 2 1 2

Link Copied to Clipboard