######################## client.pl use strict; use warnings; use diagnostics; use Time::HiRes(); use IO::Socket::INET; my $time = time; while() { my $client_socket = IO::Socket::INET->new( PeerAddr => '127.0.0.1', PeerPort => '8888', Proto => 'tcp', ) or die $!; $client_socket->autoflush( 1 ) or die $!; my $send_start = Time::HiRes::time; sleep int rand 6; warn sprintf( "PID: %s, TIME TO SEND TO SERVER: %s, ELAPSED: %s\n", $$, Time::HiRes::time - $send_start, time - $time, ); $client_socket->send( sprintf( "PID: %s, TIME TO SEND TO SERVER: %s, ELAPSED: %s\n", $$, Time::HiRes::time - $send_start, time - $time, ) ); my $recv_start = time; sleep int rand 11; $client_socket->recv( my $buffer, 1024 ); warn sprintf 'TIME TO READ FROM SERVER %s: ELAPSED: %s GOT: %s', Time::HiRes::time - $recv_start, time - $time, $buffer; }