I notice a few issues here:
First of all, the sample output you gave us could not possibly be produced by the code you've showed us because it includes lines like
DATA in $data slice 1 is THISISTHEEND which doesn't appear in your code.
Second, in your current code you are creating a new socket for every input from the user. I'm not sure if this is what you want or not. The problem is, you never close these sockets. So here's the sequence that happens right now:
- Client receives a message from the usr
- Client opens socket with server
- Server accepts connection and begins listening for client data
- Client sends data and loops, waiting for response from server
- Server receives data and writes back to client with the word THISISTHEEND
- Client receives this message and ends the loop
- Client receives next input from the user
- Client opens new socket with the server
This socket will never be accepted because the client never closed the old one, and the server is still waiting for data on 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.