Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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.
    Boots

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://90952]
help
Chatterbox?
[ambrus]: Today I accidentally cut my hand while carrying a computer. On the display part of the motherboard that sticks out at the back of the chasis and has ports, there's this thin metal sheet with holes cut for the ports, to guide plugs into the sockets.
[ambrus]: This sheet has sharp needle-like parts, 0.004 long and less than 0.001 wide, that can get bent to point outwards, and one of these cut into my palm when I lifted the box.
[ambrus]: So now when I choose what motherboard to buy for my new home computer, I have one more specific property to guide me. Useful, because there's so many different boards to choose from.

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2017-01-16 19:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (151 votes). Check out past polls.