i have a client/server program.Now i want to set timer for the same.That means if client send a request to the server and with 10 sec if the particular response is not arrive to the client then it will show the timeout.After that it will resend the request to the server and increase the value of timer.
The platform is windows
use IO::Socket::INET;
use Switch;
use strict;
open CONFIGFILE, "config.txt" or die $!;
{
local $/;
$/ = undef;
$DATA=<CONFIGFILE>;
}
my $Config = ACTI::Tiny->new();
$Config = ACTI::Tiny->read_string( $DATA );
$s = $Config->{_};
my $MySocket=new IO::Socket::INET->new(
LocalAddr=>$s->{Local_IP},
LocalPort=>$s->{Local_Port},
PeerPort=>$s->{Remote_Port},
Proto=>$s->{Transport},
PeerAddr=>$dest_ip
);
$MySocket or die "no socket :$!";
print "\nPlease wait...\n";
sub sendMessage
{
my $msg=$request;
$MySocket->send($msg);#Send
write_file($output_file,$log_meg,"Sending message:
+\n", $msg);
}
sub recvMessage
{
$MySocket->recv ($text,1000);#Recv
write_file($output_file,{append=>1},"Received Message:\n",
+ $text);
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.