in reply to communication between server/client

When you attempt to read data in your server, you are attempting to read a 'line':

while(defined(my $data=<$client_socket>))

But when your client writes the data, it doesn't add any delimiter:

print $socket $data[$_];

You need to read the docs and understand how Perl's basic IO functions work.

And whilst we're at it, what on earth is your reasoning for first joining a bunch of variables together with spaces, and then spliting them apart again?

# write on the socket to server. $_=join(' ',$status,$md,$md_others); @data=split(" ",$_);

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP an inspiration; A true Folk's Guy

Replies are listed 'Best First'.
Re^2: communication between server/client
by hari9 (Sexton) on Aug 03, 2010 at 17:37 UTC
    no reasoning, plain gross mistake. having corrected them and adding autoflush after the second socket statement in server, the client still doesnt recieve the msg sent by server.

      Did you add newlines on output from your client?

        Client Code

        use IO::Socket::INET; use IO::Handle; my($status,$md_self,@md_others); $|=1; $status=0; $md=0; @md_others=("0"); $md_others=join(' ',@md_others); $| = 1; my ($socket,$client_socket); print "TCP Connection Success.\n"; # creating object interface of IO::Socket::INET modules which inte +rnally creates # socket, binds and connects to the TCP server running on the spec +ific port. $socket = new IO::Socket::INET (PeerHost => '127.0.0.1', PeerPort => '5000', Proto => 'tcp', ) or die "ERROR in Socket Creation + : $!\n"; # write on the socket to server. $_=join(' ',$status,$md,$md_others); print $socket $_; $data=<$socket>; print $data; $socket->close();