in reply to Re^4: How to end socket file transfer without closing socket (read)
in thread How to end socket file transfer without closing socket
If it's really exist some inevitable bug or flaw, I have to modify to fix.
It appears that English may not be your primary language. I didn't refer to an inevitable problem. In the general case it is a bad idea. In specific cases it certainly can work (as you have seen).
<$sock> doesn't terminate until it finds end-of-record (EOR, $/) or end-of-file (due to shutdown or close). I often see this being used in cases where no EOR is expected and so the script just hangs. Even if you have a somewhat unusual protocol over your sockets where every transaction is supposed to terminate with an EOR, using <$sock> still means that you script "just hangs" when something goes wrong with regard to the EOR. It is much better to be able to report "I got some data but it didn't have an EOR on the end" than to just have a "hung" script and no indication why it is hung.
It is also unsafe to use <$sock> together with select (which almost any socket-based server written in Perl should probably be using).
- tye
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: How to end socket file transfer without closing socket (<$sock>)
by xiaoyafeng (Deacon) on Oct 24, 2007 at 01:27 UTC |