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; }
In reply to Socket programming by woutvc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |