redss has asked for the wisdom of the Perl Monks concerning the following question:
I am tranferring a binary file by using a filehandle over a socket connection:
The code for the client sending the file:
open(INPUT, 'file.dat'); binmode(INPUT); while (<INPUT>) { print $sock $_; } close(INPUT);
The code for the server receiving the file:
Problem is, I want the client to keep the socket connection open after sending the file, but don't know how to tell the receiving side to stop receiving the file. How can I add a condition so the receiver will know when to stop receiving the file?open(INPUT, '>file2.dat'); binmode(INPUT); while (<$sock>) { print INPUT $_; } close INPUT;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to end socket file transfer without closing socket
by ikegami (Patriarch) on Oct 23, 2007 at 16:36 UTC | |
by tye (Sage) on Oct 23, 2007 at 17:18 UTC | |
by redss (Monk) on Oct 23, 2007 at 17:13 UTC | |
by ikegami (Patriarch) on Oct 23, 2007 at 17:32 UTC | |
by tye (Sage) on Oct 23, 2007 at 17:34 UTC | |
by xiaoyafeng (Deacon) on Oct 23, 2007 at 23:33 UTC | |
by tye (Sage) on Oct 24, 2007 at 00:12 UTC | |
|