I tried to replace the POE::Session with Client::TCP, and have a few small
issues..
The client doesn't actually connect to the server, unless I add the
yield-connect line, but that seems wrong somehow. I'm going to use the GUI
to connect/disconnect, but I thought the Cient::TCP->new object would
connect me initially.
The "pulse" works fine, but I noticed that the POE::Kernel->Run isn't
executed until I close the GUI .. is that normal ?
package main;
use POE;
use POE::Component::Client::TCP;
use POE::Loop::Wx;
my $app = MyApp->new();
POE::Component::Client::TCP->new
( RemoteAddress => "10.45.44.46",
RemotePort => "32080",
ServerInput => \&server_input,
ServerError => \&handle_server_error,
Connected => \&handle_connect,
ConnectError => \&handle_connect_error,
Disconnected => \&handle_disconnect,
Started => \&handle_starting,
InlineStates => {
_start => sub {
$_[KERNEL]->yield('pulse');
#$_[KERNEL]->yield( "connect",
"10.45.44.46", "32080");
print "Starting\n";
},
pulse => sub {
if (@MyApp::frames) {
foreach (@MyApp::frames) {
$_->PoeEvent();
}
# relaunch pulse if frames still
exist
$_[KERNEL]->delay( pulse => 3 );
}
},
},
);
POE::Kernel->loop_run();
Print "This bit never runs until I kill the wx window\n";
POE::Kernel->run();
******************************************************************************
The information in this document, including any attachments or subsequent
correspondence originating from this email address ("email"), is confidential
and may be legally privileged. It is intended solely for the addressee.
However, it may be intercepted by the system controller at Bankgesellschaft
Berlin AG for the purposes of monitoring communications relevant to the system
controller's business. Access to this email by anyone else is unauthorised.
If you have received this email in error, please notify the Sender immediately
by telephone. Please also delete this email from your computer.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution or publication of this email is prohibited without the prior
consent of Bankgesellschaft Berlin AG. If you are not the intended recipient,
any action taken or omitted to be taken in reliance of this email is strictly
prohibited and may be unlawful. Bankgesellschaft Berlin AG accepts no
liability for the consequences of any person acting, or refraining from action
in reliance of this email
******************************************************************************
-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20
|