mIRC Home    About    Download    Register    News    Help

Print Thread
#10002 06/02/03 10:14 PM
Joined: Jan 2003
Posts: 30
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Jan 2003
Posts: 30
I had made a script that can ping a half-life based server and report the ping. It uses a udp socket and works fine, but if I accidently enter the wrong port I dont get any responce. Is there a way to read the packet sent back saying that the destination was unreachable? The protocal used for sending the Destination Unreachable packet is ICMP.

#10003 07/02/03 12:17 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
From the help file:

On error: if a /sockudp fails, it sets $sock().wserr to the error value, and triggers the on sockwrite event with $sockerr set.

ICMP Type 3 is Destination unreachable, which breaks down into 6 other types, based on the code field.
0 = network unreachable;
1 = host unreachable;
2 = protocol unreachable;
3 = port unreachable;
4 = fragmentation needed and "Don't Fragment" set;
5 = source route failed.

So, perhaps Winsock will return these values in $sock($sockname).wserr and $sock($sockname).wsmsg, mapped to Winsock's error values.


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#10004 09/02/03 05:54 PM
Joined: Jan 2003
Posts: 30
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Jan 2003
Posts: 30
Sorry it took me so long to reply, I was gone for a while.

Ok, in the udpread I have a line that checks if the $sockerr > 0, and returns if it is but im not real sure if its triggering. I took and added an echo at the very beginning just to see if the udpread is even reading anything and it doesnt appears be. Since the udpread does not appear to work for reading the DestUnreach packet, what would I need to use? This is confusing me and I havent be able to find anything online for mirc besides stuff related to flooding a user with ICMP DestUnreach packets, which I do not care about.

#10005 10/02/03 01:19 AM
Joined: Dec 2002
Posts: 1,321
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Dec 2002
Posts: 1,321
on *:SOCKWRITE: .. not on *:UDPREAD:


DALnet: #HelpDesk and #m[color:#FF0000]IR[color:#EEEE00]C
#10006 11/02/03 08:16 PM
Joined: Jan 2003
Posts: 30
R
Ameglian cow
OP Offline
Ameglian cow
R
Joined: Jan 2003
Posts: 30
Thank you very much Hammer . It works perfectly now.


Link Copied to Clipboard