in reply to SELECT help...

One problem with your code is that you have a typo: Net::SMPP-new_receiver instead of Net::SMPP->new_receiver. You should always "use strict;" which will catch that error.

Not knowing the complete context for your problem, I think that you want something like this:

my $channel = $rec[$RXThreadNumber]; my $select = IO::Select->new($channel); my $timeout=30; while ($channel) { my @ready = $select->can_read($timeout); if (@ready) { # If you add more sockets to select object, # this code will need to change if($pdu = $channel->read_pdu()) { print("Fetching pdu\n"); processpdu($pdu, $RXThreadNumber); } else { # eof or error on socket # you can do something like this: $select->remove($channel); $channel->close(); # Now, do you want to try to reconnect? If so, something # like this: if ($channel = TryReconnect($RXThreadNumber)) { $select->add($channel); } } } else { # Time-out print("Enquiring link...\n"); if($rec[$RXThreadNumber]->enquire_link()) { print("Link is fine...\n"); } else { print("Link is DOWN! Bringing up again...\n"); $select->remove($channel); $channel->close(); if ($channel = TryReconnect($RXThreadNumber)) { $select->add($channel); } } } } # We exit loop if we are no longer connected sub TryReconnect { my ($threadnum) = @_; $rec[$threadnum] = Net::SMPP->new_receiver( $tshost, smpp_version => $smppVer, system_id => $tssysid, password => $tspassword, system_type => $tssystype, dest_addr_ton => 0x91, dest_addr_npi => 0x00, addr_ton => 0x91, addr_npi => 0x00, source_addr_ton => 0x91, source_addr_npi => 0x00, port => $tsport ) or warn("can't connect to smsc: $!\n"); }