can't connect to sirens server

For everything NOT server specific support. Do NOT ask for connectivity help here!.

Moderator: Moderators

Message
Author
corneliad
Noob
Noob
Posts: 3
Joined: 12 Aug 2011, 20:55
Noob?: No

can't connect to sirens server

#1 Post by corneliad »

What should I do about it?

This problem just happpened , and it has error massage "
Can't call method "connected" on an undefined value at D:\setopk\BotOrganizer\Profiles\.....\Plugin/Sirens.pl line 51.
"

error.txt
Died at this line:
if ($switch eq '02A6') {
* unless ($sirens_socket->connected()) {
return unless (connect2sirens(\$sirens_socket));

EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: can't connect to sirens server

#2 Post by EternalHarvest »

Problem in that plugin.

corneliad
Noob
Noob
Posts: 3
Joined: 12 Aug 2011, 20:55
Noob?: No

Re: can't connect to sirens server

#3 Post by corneliad »

Could you help me ?
I will copy it at overhere.

corneliad
Noob
Noob
Posts: 3
Joined: 12 Aug 2011, 20:55
Noob?: No

Re: can't connect to sirens server

#4 Post by corneliad »

Code: Select all

package Sirens;

use strict;
use Globals;
use Plugins;
use Log qw(error);
use Misc qw(relog);
use Utils qw(dataWaiting);
use IO::Socket::INET;

Plugins::register('Sirens', 'Sirens Server Plugin', \&onUnload);

my $hooks = Plugins::addHooks(
        ['initialized', \&onInitialized],
        ['mainLoop_pre', \&onMainLoopPre],
        ['parseMsg/pre', \&onParseMsg]
);

sub onUnload {
        Plugins::delHooks($hooks);
};

my $sirens_host = 'xxxxxxx';
my $sirens_port = xxxxx;
my ($sirens_socket, $failecount);

sub onInitialized {
        $sirens_socket = IO::Socket::INET->new();
        connect2sirens(\$sirens_socket);
}

sub onMainLoopPre {
        if (dataWaiting(\$sirens_socket)) {
                my $buf;
                $sirens_socket->recv($buf, 512);
                $net->serverSend($buf) if (length($buf) > 1);
        }

        if ($failecount >= 3) {
                quit();
        }
}

sub onParseMsg {
        my $args = $_[1];
        my $switch = $args->{switch};
        my $msg = $args->{msg};
        my $msg_size = $args->{msg_size};

        if ($switch eq '02A6') {
                unless ($sirens_socket->connected()) {
                        return unless (connect2sirens(\$sirens_socket));
                }

                $sirens_socket->send(substr($msg, 0, $msg_size));
        }
}

sub connect2sirens {
        my ($r_socket) = @_;

        ${$r_socket} = IO::Socket::INET->new(
                PeerAddr => $sirens_host,
                PeerPort => $sirens_port,
                Proto => 'tcp'
        );

        if (${$r_socket} && inet_aton(${$r_socket}->peerhost()) eq inet_aton($sirens_host)) {
                $failecount = 0;
                return 1;
        } else {
                error("Can't connect to Sirens Server.\n");
                relog() if ($conState == 5);
                $failecount++;
                return 0;
        }
}

return 1;

Post Reply