Well, you're trying to listen on port 2000 and the error message tells you it can't get that port. That probably means something else is already running and listening on that port (and given I see an entry in /etc/services saying that's an assigned port it's entirely reasonable; not to mention 2000's close enough to 1024 that I don't doubt something else could have gotten in for outgoing traffic on a heavily used box).

Pick a different (higher; try 9999) port number and see if you get the same error.

Update: Aaah, it's your client script that's producing the error. Never mind me, I misread. Where's my caffeine . . .

Hrmm, are you sure your listener's running? Does it print out the line after you check that $sock is defined? If you check with lsof does the process appear to have the socket open (presuming you're on some flavour of *NIX here)?

I'd still try a different port just for kicks as well.


In reply to Re: Simple Sockets by Fletch
in thread Simple Sockets by stellagoddc

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.