xiaoyafeng has asked for the wisdom of the Perl Monks concerning the following question:
The scirpt can connect to server successfully. But I can't input any command to CLI window(no operate,no echo). In fact, The command I input echo to CLI until I quit the script. I suspect that it related to Windows, but I can't be sure.my $run = 1; while( $run ) { $msn->do_one_loop(); } # do_one_loop is in MSN.pm sub do_one_loop { my $self = shift; # return immediately if we are not connected return if( !$self->{Connected} ); $self->{Notification}->ping( ); foreach my $convo (values %{$self->getConvoList()}) { $convo->p2pSendOne() if $convo->p2pWaiting; } my @ready = $self->{Select}->can_read(.1); foreach my $fh ( @ready ) { # get the filenumber for this filehandle my $fn = $fh->fileno; # get the object assocatied with this filenumber my $connection = $self->{Connections}->{$fn}; # DO WE NEED THIS CODE? if the connection is really dead, will + it even be showing up in the list of filehandles that can be read fr +om?? # if the connection is dead, remove it from the select, delete + it from the Connections list and output a warn if( !$connection->{Socket}->connected() ) { $self->{Select}->remove( $fn ); delete( $self->{Connections}->{fn} ); warn "Killing dead socket"; next; } sysread( $fh, $connection->{buf}, 2048, length( $connection->{ +buf} || '' ) ); while( $connection->{buf} =~ s/^(.*?\n)// ) { $connection->{line}= $1; my $incomingdata = $connection->{line}; $incomingdata =~ s/[\r\n]//g; print( "($fn $connection->{Type}) RX: $incomingdata\n" ) i +f( $self->{ShowRX} ); my $result = $connection->dispatch( $incomingdata ); last if( $result && $result eq "wait" ); } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't use MSN
by ikegami (Patriarch) on Apr 28, 2007 at 02:50 UTC | |
|