A quick question:
Is $socket really an IO::Socket::INET object or is it the result of the accept method?

I did a simple test script:

#!/usr/local/bin/perl -w use strict; use IO::Socket; my $sock = IO::Socket::INET->new( Proto => 'tcp', LocalPort => 8080, Listen => SOMAXCONN, Reuse => 1 ); my $data = 'Silly test string.'; { local $\ = qq(\0); print $sock $data || die "What happened? $!"; }
..and this executes just fine, no warnings, no errors. Did I mention that there's no client on the other end?

If you don't make $socket like this (set your ports and such however):

$inet = IO::Socket::INET->new( Proto => 'tcp', LocalPort => 8080, Listen => SOMAXCONN, Reuse => 1 ); $socket = $inet->accept();
then it's entirely possible that you never talk to your client properly at all. The fact that it exits as though it sees a null byte may simply be a timeout exit.

Just a thought -- I'm no socket guru :)


In reply to Re: more zero byte madness by snax
in thread more zero byte madness by chorg

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.