in reply to Re: flushing sockets
in thread flushing sockets
The timeout ONLY fires when I press return on the kb once the aplication starts.... any idea's? Thanks Scuzz. (;my $selectFD; $selectFD = new IO::Select($rec[$RXThreadNumber], undef, undef, 1); $|++; # flush the buffer apparently... while(@bits = $selectFD->can_read) { select(undef, undef, undef, 0.1); foreach $fdThread (@bits) { if($fdThread == $rec[$RXThreadNumber]) { print("Fetching pdu\n"); # the following if is to make sure that the only time we try + fetch an sms # is when there is actual sms activity on the socket... and +nothing else... # this was causing problems before because a sock kill init +was creating# noise on the line and the aplication was trying to ent +erperet this as # a PDU... if($pdu = $rec[$RXThreadNumber]->read_pdu()) { print("CMD: $pdu->{cmd}\n"); print("STATUS: $pdu->{status}\n"); print("SERTYPE: $pdu->{service_type}\n"); print("SEQ: $pdu->{seq}\n"); print("SOURCE: $pdu->{source_addr}\n"); print("DESTINATION: $pdu->{destination_addr}\n"); #print("DATA: $pdu->{data}\n"); print("MESSAGE: $pdu->{short_message}\n"); $test = $rec[$RXThreadNumber]->deliver_sm_resp(seq=>$pd +u->{seq}, message_id=>''); my $nowRXTime = genTime(); my $queryRX = $tdbh->prepare("insert into MOHits values +(NULL, NULL, \"$pdu->{source_addr}\", \"$nowRXTime\", \"$pdu->{short_ +message}\", 0, \"$pdu->{destination_addr}\")"); $queryRX->execute; print("Fetched pdu\n"); } } if((time() - $startTime) > 5) { $startTime = time(); print("Enquiring link...\n"); if($rec[$RXThreadNumber]->enquire_link()) { print("Link is fine...\n"); } else { print("Link is DOWN! Bringing up again...\n"); $rec[$RXThreadNumber] = Net::SMPP-new_receiver( $tshost, smpp_version => $smppVer, system_id => $tssysid, password => $tspassword, system_type => $tssystype, dest_addr_ton => 0x91, # Type Of Number, +this means its "2783XXXXXXX" 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"); } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: flushing sockets
by Thelonius (Priest) on Feb 17, 2003 at 14:59 UTC | |
by scuzzy (Novice) on Feb 18, 2003 at 10:22 UTC | |
|
Re: Re: Re: flushing sockets
by Tomte (Priest) on Feb 17, 2003 at 10:48 UTC |