You need to 'accept' the socket. The old socket is then reused:
print "Incoming connection detected!\n";
my $new_sock = $listen_sock->accept
or die "Could not accept socket: $!";
then you should do a
recv $new_sock,$z,10000,0;
to read from your socket. tye will tell you that <SOCKET> is bad, mmmmkay?
Sorry.. too tipsy to do more than cut and paste from my own code.
As near as I can tell 'accept' clones the socket, then goes back to listening on the old one. If anyone here would care to explain...
The docs are pretty short on this operation. Going through other people's code is the best way in this case.
____________________
Jeremy
I didn't believe in evil until I dated it.
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.