Hi All .
In sockets I have written the client server program .
First I tried to send the normal string among them it sends fine .
After that I am trying to send the hash and array values from client to server and server to client .
When I printing the values using Dumper . It is giving me only reference
. What Should I do for getting accessing the actual values in client server .
my %hash = ( "name" => "pavunkumar " , "age" => 20 ) ;
my $new = \%hash ;
#Turn on System variable for Buffering output
$| = 1;
# Creating a a new socket
'localhost','Listen' => 5 , 'Reuse' => 1 );
die "could not create $! \n" unless ( $socket );
print "\nUDPServer Waiting port 5000\n";
my $new_sock = $socket->accept();
my $host = $new_sock->peerhost();
#my $line = <$new_sock>;
print Dumper "$host $_";
print $new_sock $new . "\n";
print "$host is closed \n" ;
use Data::Dumper ;
use warnings ;
use strict ;
my %hash = ( "file" =>"log.txt" , size => "1000kb") ;
my $ref = \%hash ;
# This client for connecting the specified below address and port
# INET function will create the socket file and establish the connecti
my $port = shift || 5000 ;
my $host = shift || 'localhost';
my $recv_data ;
my $socket = new IO::Socket::INET (
PeerAddr => $host ,
PeerPort => $port ,
Proto => 'tcp', )
or die "Couldn't connect to Server\n";
my $line = <stdin> ;
print $socket $ref."\n";
if ( $line = <$socket> )
print Dumper $line ;
print "Server is closed \n";
I have given my sample program about what I am doing ,
Can any one tell me what I am doing wrong in this code.
And what I need to do for accessing the hash values .