mIRC Home    About    Download    Register    News    Help

Print Thread
#8773 29/01/03 03:22 PM
Joined: Jan 2003
Posts: 119
A
AKO Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2003
Posts: 119
on *:socklisten:test:{
echo -a $sock(test).ip
if ($read(sockets.txt,w,$gettok($sock(test).ip,1-3,46))) {
sockaccept %sock.num
inc %sock.num
echo -a Socket Accepted
}
else {
echo -a Socket Not Accepted
}
}

$sock().ip returns the IP of my nat computer, is there any way to get it to return the original source of the connection?

#8774 30/01/03 03:25 AM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
$sock(%sock.num).ip

Of course, you must accept it before being able to retrieve the IP address.

I have already suggested in the old suggestions board, to make a local identifier which returns the incoming IP address of the Socklisten event, without having to accept the connection first.

#8775 30/01/03 02:03 PM
Joined: Jan 2003
Posts: 119
A
AKO Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2003
Posts: 119
Well isn't that pretty gay, LOL. That's not good now is it...I don't really want to accept the connection if I don't have to that's pretty ass backwards, but I'll keep that in mind. However, I do support fixing the behavior to work before you accept the socket connection.

#8776 30/01/03 02:27 PM
Joined: Jan 2003
Posts: 119
A
AKO Offline OP
Vogon poet
OP Offline
Vogon poet
A
Joined: Jan 2003
Posts: 119
For those that may be looking for an example of socket code, here is an updated version to the original, sort of working around the issue of accepting connections to get the $sock().ip Also mildly cleaner smile

on *:socklisten:connect:{
sockaccept verify
echo -a Socket Accepted
if (!$read(sockets.txt,w,$gettok($sock(verify).ip,1-3,46))) {
sockclose verify
Echo -a User is not in Access list
}
else {
Echo -a User Accepted
sockwrite $sockname You are Accepted
sockrename verify conn_ $+ $rand(1,9999)
}
}


Link Copied to Clipboard