Hello all,
I am a beginner and am having some troubles over coming this issue. I have searched on the internet and have learned a lot in the process but have not been able to get past my roadblock.

I am having trouble sending a hash across a tcp socket I have setup. I am using the IO::Socket module to setup the client and server. I am running my tests on 2 freebsd 8.1 x64 machines. Here is a snippet of what I am trying to do:

#server code
my %hash = ('tom' => 'brady', 'brett' => 'favre');
$send_data = nfreeze(\%hash);
$client_socket->send($send_data);


#client code
$socket->recv($recv_data,1024);
my $ref = thaw($recv_data);
print $ref;


When i try to just print in the client code I get nothing. No errors and no output.

When I use this code in a simple test script it works as i expect. Here is my test code snippet not using sockets at all:

#local script
use Storable qw(nfreeze thaw);
my $hash = {'tom' => 'brady', 'brett' => 'favre'};
print my $test = nfreeze($hash);
print thaw($test);


Can anyone point me in the right direction as to why I can't get this to work over a tcp socket?

Thank you very much for your time. Sorry everyone, had to much to drink last night. I did not have $| set properly.... please disregard my stupidty. THanks

In reply to Serializing data using storable over socket by kernelzack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.