Hello, POE folks!
A co-worker and I have a couple of questions about how to handle the
failure of an IKC client to connect to a remote IKC server.
Question 1:
-----------
The IKC::Client documentation says the following about the 'on_error'
parameter to the create_ikc_client command:
DEPRECATED. Please use the IKC/monitor stuff.
See POE::Component::IKC::Responder.
But the monitoring mechanism in IKC::Responder seems to assume that
an IKC connection has already been made. So what's the proper way to
deal with failure of an IKC connection to be opened in the first place?
(For example, if there simply isn't an IKC server listening at the
given address and port.) Maybe for that purpose, 'on_error' shouldn't
actually be deprecated after all?
Question 2:
-----------
(This is probably a question for Philip Gwyn, the IKC author (thanks,
Philip, IKC rocks!). But we're posting it here in case anyone else
has seen the same problem with the new IKC version.)
It appears that the latest version (0.18) of IKC Client can cause a
segmentation fault if it fails to connect to an IKC server. This is
the resulting error message:
Can't locate object method "DELETE" via package
"POE::Wheel::SocketFactory" at
/usr/lib/perl5/site_perl/5.8.3/POE/Component/IKC/Client.pm
line 158.
Segmentation fault
Below is the code of our test program that produces the above error
when running on Linux. We're using the latest version of SocketFactory.
We've found that if we simply comment out line 158 of the Client.pm
module, the problem goes away. That line is commented as being a
workaround, but there's no description of what problem it works around.
Our question: Is this a bug, or are we doing something incorrectly?
Thanks for any thoughts or help!
(Our test program follows.)
Tim Klein
Dallas, Texas, USA
==================================
use POE;
use POE::Component::IKC::Client;
sub _start {
print STDERR "_start event received\n";
create_ikc_client(
port => 6969,
name => 'testclient',
on_connect=>$_[SESSION]->postback('connected'),
on_error=>$_[SESSION]->postback('error'),
);
}
sub connected {
print STDERR "Connected event received\n";
}
sub error {
print STDERR "Error event received: (@{$_[ARG1]})\n";
}
POE::Session->create(
inline_states => {
_start => \&_start,
connected => \&connected,
error => \&error,
_default => sub {
print STDERR "Unknown event $_[ARG0] received\n";
},
}
);
POE::Kernel->run();
__END__
Running this program under Linux produces the following output:
_start event received
Unknown event _child received
Can't locate object method "DELETE" via package
"POE::Wheel::SocketFactory" at
/usr/lib/perl5/site_perl/5.8.3/POE/Component/IKC/Client.pm line 158.
Segmentation fault
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|