woutvc has asked for the wisdom of the Perl Monks concerning the following question:
But if the client unexpectedly disconnects I get stuck and have to restart the program. How can I avoid this?while(1) { &write_log(\*LOG,$program,"Waiting for client to connect..."); while($client = $server->accept()) { $client->autoflush(1); while (<$client>) { chomp; $buffer=substr($_,0,66); my ($time) = time; my $loctime = localtime($time); &write_log(\*LOG,$program,"SERV <- CLNT <$buffer>"); # Call FAB_TELEGRAM.PROCESS_V2 $sth = $dbh->prepare( q{ BEGIN :answer:= FAB_TELEGRAM.PROCESS(:buffer); END; } ); $sth->bind_param_inout( ":answer", \$answer, 195 ); $sth->bind_param_inout( ":buffer", \$buffer, 195 ); eval{ $sth->execute; }; print $client "$answer\n"; &write_log(\*LOG,$program,"SERV -> CLNT <$answer>"); &ora_commit($dbh); } &write_log(\*LOG,$program,"Waiting for client to connect..."); close $client; } &write_log(\*LOG,$program,"Waiting for counter $counter"); $counter = $counter+1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Socket programming
by SuicideJunkie (Vicar) on Nov 12, 2008 at 15:34 UTC | |
by Illuminatus (Curate) on Nov 12, 2008 at 16:11 UTC | |
by SuicideJunkie (Vicar) on Nov 12, 2008 at 18:10 UTC | |
|
Re: Socket programming
by Illuminatus (Curate) on Nov 12, 2008 at 15:21 UTC |