Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: client server file transfer

by repson (Chaplain)
on Jun 23, 2001 at 14:24 UTC ( #90952=note: print w/replies, xml ) Need Help??

in reply to client server file transfer

If you have full control over the protocol and both client and server implementation then I would consider a different method. It would be possible to continue using a end tag, but it can be difficult to do that correctly and reliably without fiddling with various selects and reading methods and hoping that piece of data won't appear in the file.

Alternativly I would do what some protocols do and use a message content length (in exact bytes) so that the reciver knows exactly how much binary data to read, after which normal operation can resume.

For this you could just add a line to the sender to like print OUT "Size: " . (-s $file) . "\n"; and the reciver can parse that line of data and use one or a series of read statements to recieve exactly that much data.

Replies are listed 'Best First'.
Re: Re: client server file transfer
by Boots111 (Hermit) on Jun 25, 2001 at 16:58 UTC
    I agree with you about the tags, I was still in the "hope that the problem doesn't show up" phase. However, that little trick (-s) to send the filesize solves this problem perfectly.

    Thanks for your help.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://90952]
[Tanktalus]: Discipulus: I should be working on an interview test right now. Well, I kind of am, but keep getting myself distracted :)
[Lady_Aleena]: marioroy, nope, that IS the error.
[Discipulus]: oh to be distracted PM is still a wonderfull place
[Tanktalus]: Problem is, it's a test for another monk - as in, another monk letting me interview for his company :)
[Tanktalus]: He might see me here... :D
[Discipulus]: it's me? ;=)
[marioroy]: Lady_Aleena could it be a quoting issue? I just tried find with -exec on the command line. find . -name "*.pl" -exec ls -l {} \;
[Tanktalus]: No, I know who he is, nice try. But if you're hiring, let me know :)
[Tanktalus]: Lady_Aleena: yeah, I can reproduce your issue, it's confusing alright :)
[Tanktalus]: I'm sure it'll make perfect sense once we figure it out :)

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2017-04-23 20:00 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (432 votes). Check out past polls.