For various reasons, I've ended up writing a Java-client that communicates with MUSHClient using the zchat-protocol, and so far I'm well-pleased with the results, except for one problem.
Occasionally, MUSHClient will reject my zchat-login attempt, for unknown reasons. It appears that the reject happens early, sometime before the perl-code in my MUSHClient-plugin is called to authorize the connection. In an attempt to debug this behaviour, I wrote a small Java-app that attempts to connect to MUSHClient repeatedly using the exact same login-data, and outputting the results to the console. The exact same login can be accepted, then rejected, then accepted again, in three separate login-attempts happening after eachother.
Each login consists of my Java-app connecting to the MUSHClient chat-socket, waiting for 100ms, then sending the string 'ZCHAT:myUser\t\n111.111.111.11104050', then waiting for the first byte to check if it's a 'Y' or a 'N', then closing the socket and waiting for another 1000ms before retrying. The delays seem irrelevant, 1ms or 1000ms, the denials still occur.
On MUSHClient's end, the perl-code handling the connection looks like this:
# MUSHclient has received a connection from IP,name
# Return TRUE to accept it, FALSE to reject it
sub OnPluginChatAccept {
my ($tempstring) = @_;
$tempstring =~ /(.*?),(.*)/;
my $username = $2;
if ($username eq "myUser") {
echo("accepted");
return 1;
} else {
echo("rejected");
return 0;
}
}
..and this code prints 'accepted' to my MUSHClient-window every time a connection is accepted, but strangely enough, never 'rejected', which leads me to believe that the connection is rejected earlier, for some reason.'
The Java-code I use can be provided too, but it's not nearly as short as the Perl-code.
I'm using MUSHClient 3.42, on Windows XP.
Occasionally, MUSHClient will reject my zchat-login attempt, for unknown reasons. It appears that the reject happens early, sometime before the perl-code in my MUSHClient-plugin is called to authorize the connection. In an attempt to debug this behaviour, I wrote a small Java-app that attempts to connect to MUSHClient repeatedly using the exact same login-data, and outputting the results to the console. The exact same login can be accepted, then rejected, then accepted again, in three separate login-attempts happening after eachother.
Each login consists of my Java-app connecting to the MUSHClient chat-socket, waiting for 100ms, then sending the string 'ZCHAT:myUser\t\n111.111.111.11104050', then waiting for the first byte to check if it's a 'Y' or a 'N', then closing the socket and waiting for another 1000ms before retrying. The delays seem irrelevant, 1ms or 1000ms, the denials still occur.
On MUSHClient's end, the perl-code handling the connection looks like this:
# MUSHclient has received a connection from IP,name
# Return TRUE to accept it, FALSE to reject it
sub OnPluginChatAccept {
my ($tempstring) = @_;
$tempstring =~ /(.*?),(.*)/;
my $username = $2;
if ($username eq "myUser") {
echo("accepted");
return 1;
} else {
echo("rejected");
return 0;
}
}
..and this code prints 'accepted' to my MUSHClient-window every time a connection is accepted, but strangely enough, never 'rejected', which leads me to believe that the connection is rejected earlier, for some reason.'
The Java-code I use can be provided too, but it's not nearly as short as the Perl-code.
I'm using MUSHClient 3.42, on Windows XP.