See the perl network examples at Prof Golden's Perl Client server basics. Of course, it is basic Perl, but modules like IO::Socket and IO::Select make things easier. As far as writing and receiving simultaneously, there are 3 solutions: use IO::Select, fork, or use threads. Generally select is used when the messages are short, because the server will only handle one client at a time. If big files are transferred, you usually using a forking design.

It's a big topic, and you can search google and groups.google.com for "perl server client", "perl server IO::Select", "perl multi-echo chat", etc. There are many variations on server client setups. In general, for a client, you want a forking client. When it connects, it immediately forks off, one fork is solely for receiving, and 1 fork for sending. See Simple bi-directional forking commandline client for a basic client that should work with almost any server, like a telnet client.


I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re: Server/client sync - when can I write to a socket? by zentara
in thread Server/client sync - when can I write to a socket? by techcode

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.