Without seeing your code, if you keep the threads in a recv() loop, you are effectively locking them into just receiving. 2-way sockets need to be handled in a bi-directional manner, see
Simple threaded chat server for some ideas. Else, you can use a shared variable to your threads, which they can use to switch them to the send() mode.
Or you could spawn 2 threads, one for sending or for receiving. This is what is commonly done in socket clients, they are forked( or threaded) to make them receive/send at the same time....i.e. bidirectional. See Simple bi-directional forking commandline client
Without the bidirectional forking/threading/select code in your socket code, you will need to setup a protocol to tell both ends of the connection which mode to be in send() or recv(), and constantly juggle them.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.