Slashdot Mirror


Guaranteed Transmission Protocols For Windows?

Michael writes "Part of our business at my work involves transferring mission critical files across a 2 mbit microwave connection, into a government-run telecommunications center with a very dodgy internal network and then finally to our own server inside the center. The computers at both ends run Windows. What sort of protocols or tools are available to me that will guarantee to get the data transferred across better than a straight Windows file system copy? Since before I started working here, they've been using FTP to upload the files, but many times the copied files are a few kilobytes smaller than the originals."

41 of 536 comments (clear)

  1. UDP. by langelgjm · · Score: 5, Funny

    Clearly you're looking for UDP. Next question.

    --
    "Anyone who [rips a CD] is probably engaging in copyright infringement." - David O. Carson
    1. Re:UDP. by Underfoot · · Score: 3, Informative

      UDP is actually a great basis for accelerated file transfer. Several file transfer utilities / protocols have been built around it. I deal with really large files, but I have been using Aspera on several projects with great success. Worth a look.

      http://www.asperasoft.com/

      --
      I mentioned tinker-toys once in a post - now I'm modded down for life.
    2. Re:UDP. by El+Torico · · Score: 4, Funny

      Now I know the sound of packets being dropped. Thanks.

      --
      In the land of the blind, the one-eyed man is usually crucified.
    3. Re:UDP. by sofar · · Score: 5, Funny

      TCP is so horrible. I wish HTTP used UDP by default so I wouldn't have the pro

  2. Any encrypted transmission protocol actually by guruevi · · Score: 4, Informative

    SFTP should do since the communications are encrypted, if something changes along the way it should be rejected by the other end. HTTPS and any other protocol-over-SSL should do.

    FTP is a plain-text protocol so if something changes along the way it won't give you any issues.

    --
    Custom electronics and digital signage for your business: www.evcircuits.com
    1. Re:Any encrypted transmission protocol actually by jeffmeden · · Score: 4, Informative

      Using modern encryption like SSH does guarantee that things *have to add up* since keeping what you start with a secret is just as important (sometimes more so) as making sure you finish with exactly what you start with (meaning no one in the middle meddled with your data).

      So, in short, something like SSH or any other properly encrypted communication mechanism is a great way to both secure the data from snooping (in the case of a microwave link, a VERY real problem) as well as to safeguard the data from corruption (intentional or unintentional). I sincerely hope, for the asker's sake and possibly for the country's sake, that these files he works with are trivial.

    2. Re:Any encrypted transmission protocol actually by Anonymous Coward · · Score: 4, Funny

      I sincerely hope, for the asker's sake and possibly for the country's sake, that these files he works with are trivial.

      Well, let's see.

      transferring mission critical files across a 2 mbit microwave connection, into a government-run telecommunications center

      Pretty sure encryption isn't necessary.

    3. Re:Any encrypted transmission protocol actually by link-error · · Score: 5, Insightful

      Wrong. FTP has a binary mode. This is probably the reason his files are missing several k at the destination. Sending a binary file in ascii mode is the ONLY TIME I've ever had a file not transfer entirely/correctly using FTP. Unless of course there is a network error/timeout, etc, but the FTP client always errored out in those cases. Using SFTP over an already secure network will only slow things down greatly.

      --
      -Unresolved symbol? Byte me!
  3. TCP? by causality · · Score: 4, Interesting

    The summary states that with FTP, the downloaded files were of the wrong size. Can anyone explain why TCP's efforts to to deal with unreliable networks, such as the retransmission of unacknowledged packets and their reassembly in proper order, would not already deal with this? I am familiar with the concepts involved but I think I lack the low-level understanding of how you would get the kind of results the story is reporting.

    --
    It is a miracle that curiosity survives formal education. - Einstein
    1. Re:TCP? by Anonymous Coward · · Score: 5, Insightful

      TCP has timeouts. The FTP client and server probably have timeouts. Eventually, some bit of the system will decide the operation is taking too long and give up. The FTP client is probably reporting an error, but if it's driven by a poor script no-one will know.

    2. Re:TCP? by Zocalo · · Score: 5, Informative

      The only times I've seen FTP report a successful file transfer and have a file discrepency is when a binary file has been transferred in ASCII mode and the CR/LF sequences are being swapped for just CRs, or visa versa. Nothing wrong with the protocol, PEBKAC...

      --
      UNIX? They're not even circumcised! Savages!
    3. Re:TCP? by AvitarX · · Score: 4, Insightful

      I bet it is file systems with different block sizes rounding slightly differently, and an OP that does not understand.

      --
      Wow, sent an e-mail as suggested when clicking on "use classic" banner, and got a fast response that addressed my msg
    4. Re:TCP? by amoeba1911 · · Score: 5, Informative

      I'm gonna learn you some English: First, I will download my photos to my Facebook page. Then I will borrow you my car but in collateral I demand you borrow me you're lawnmower for a week so I can mow my lawn. Your smart, so you will do good on your next test.

    5. Re:TCP? by bwcbwc · · Score: 5, Informative

      I used to get dropped characters and groups of characters in text files using FTP back in the 1990s and early 21st century. It seemed to be a bug in the FTP client, because it only happened when we used the Windows Explorer interface for the product. When we did command line or used the native GUI there was no problem. If you're seeing this type of a pattern where you can see that characters are missing, switch to a different FTP client or try the Windows command line FTP.

      Another possibility is that the target Windows system is mimicking a Unix system, so that an ASCII transfer is stripping the CR characters from CR/LF sequences.

      On the other hand, if you really want a "guaranteed delivery" with formal acknowledgment and validation, try using a secured protocol like SSH or SFTP or a messaging system like JMS with a handshaking architecture around it. There are plenty of Open Source architectures you can build around (xBus for example), but I don't know of any ready-built executables. Commercially, vendors like IBM (MQ) and Tibco have products that deal with the messaging at a similar level.

      --
      We are the 198 proof..
    6. Re:TCP? by ShieldW0lf · · Score: 3, Informative

      You could deal with a situation like this by zipping or rarring it into multiple small files and including parity files.

      http://en.wikipedia.org/wiki/Parchive

      --
      -1 Uncomfortable Truth
    7. Re:TCP? by samkass · · Score: 5, Informative

      While others point out, probably correctly, that the problem is probably a binary/ascii conversion, in actuality the error checking on TCP is simply not that good.

      TCP uses a 16-bit checksum, so you have 1 in 65536 chance of an error packet being incorrectly validated as being correct. To make matters worse, it uses 1's complement instead of 2's complement, so 0x00 and 0xFF are indistinguishable.

      Ethernet has a 32-bit, 2's complement checksum so if you're transmitting over that link-layer you're probably in good shape. But depending on that from a systems point of view seems risky.

      Much better to only transfer ZIPs and check them at the other end if you only have control over the endpoints. If you can control the transmission, use a better error-correcting high-level protocol or even a forward-error correction protocol on top of TCP.

      Or just use rsync.

      --
      E pluribus unum
    8. Re:TCP? by Obfuscant · · Score: 5, Informative
      Since ASCII files are also ultimately represented as particular sequences of binary data, why does FTP even have an ASCII transfer mode?

      Because of differences between systems like Unix and Windows, where line ends are a simple newline on Unix but a CR/LF pair on Windows. Also systems like VMS which have (had) about thirteen different file formats all inherent in the file structure itself.

      In other words, because all ASCII files are not represented the same way by all different operating systems.

      I know that Windows uses CR/LF for line termination and *nix uses just LF. That's a very minor inconvenience at worst,

      Not if you have an "ASCII" file you are trying to read on Windows that has Unix newline conventions. Try opening a newlined file with notepad, for example.

      ...and little standalone utilities to convert the formats are readily available and have been for some time now.

      "Little standalone utilities" are really handy for small files and small numbers of files. It's really handy when you know the format the file you have is in and what it needs to be. Please tell me how you will identify a VMS fixed record file that you have just ftp'd from a VMS FTP server when it gets to your Windows system. It has NO newlines or CR/LF pairs. You might dump the file somehow and notice that the lines are all 93 characters long and then write yourself a perl script to split it up -- or you could simply tell your FTP client that you are in ASCII mode and let the FTP server/client negotiate some resulting format that your system likes. Now try that with a VMS variable length record file, where the lines are variable length, still without line endings.

      FTP wasn't designed just for hobbyists who want a file or two and have the time to deal with file formats by hand. It was designed to move data, and anything that can be automated should be. "Little standalone utilities" are a pain in the ass when trying to automate something, especially when the critical information necessary to know what specific utility to use has been lost, or is completely unknown to the recipient's system. Like VMS fixed length records on Unix or Windows.

      It just seems like it's not the job of a file transfer protocol to concern itself with what an independent, unrelated application can or cannot do with the file after it's transferred.

      ASCII mode in FTP has nothing to do with anyone trying to tell anyone what they can or cannot do with a file after it's transferred. It's all about knowing how to deal with a hundred different ways of representing ASCII data on dozens of different operating systems and making life EASIER for people who have to do that on a daily basis.

      If YOU would rather operate in BIN mode and worry about which file formats you've just downloaded and how to convert them to an ASCII representation that your software knows how to deal with, more power to you. I got tired of dealing with this the first time I had to convert a VMS "ASCII" file to Unix and I'll let FTP do it silently for me. Yes, I've dealt with users who didn't know what ASCII mode was and downloaded a zipped file in ASCII mode and it didn't work, but the time I've saved just myself not having to deal with converting crap has more than made up for the time I've spent telling them to use BIN mode.

    9. Re:TCP? by Jimmy_B · · Score: 3, Interesting

      Not if you have an "ASCII" file you are trying to read on Windows that has Unix newline conventions. Try opening a newlined file with notepad, for example.

      As far as I can tell, the problem is entirely unique to notepad. Every other text editor I've ever tried handles files with Unix-style newlines correctly. Since it would be trivial to fix Notepad, I can only assume that Microsoft either doesn't care at all about Notepad, or is deliberately leaving the incompatibility in place to discourage use of Unix.

    10. Re:TCP? by link-error · · Score: 3, Informative

      I replied similar to this above, but if you're microwave connection is generating any binary data and you're transmitting using ascii mode, you'll get file size differences at the destination.

      --
      -Unresolved symbol? Byte me!
  4. Robocopy? by wafath · · Score: 5, Insightful
    1. Re:Robocopy? by Anonymous Coward · · Score: 5, Informative

      Yeah but that extra functionality contains things like the ability to resume a transfer, retry if things fail, and verify the files after copying.

    2. Re:Robocopy? by Saint+Stephen · · Score: 5, Informative

      MOD PARENT UP. Not to mention it's multithreaded, so it's not really the same as copy/paste - it's the same as a whole bunch of copy/pastes as the same time.

      Why do people keep fighting the Robocopy, I'll never know.

    3. Re:Robocopy? by Malc · · Score: 3, Insightful

      It might be using Windows copy protocols, but it definitely is not like copy/paste. It's restartable for instance. It's way more reliable.

      We have to copy large files to our office in China. FTP always fails. Windows copy via Explorer often fails, but it is also incredibly painful to do when latency is high and one is browsing over the network. Robocopy (depending on system setup) will motor through and is very persistent when there's a connection hiccup. You definitely want restartability if you copy large files are a couple of hundred MB an hour.

      I'd say make sure to break the files up in to chunks if they're large. Also, run 2-4 robocopies in parallel if the latency is high as this will give better throughput. It can do funny things to Windows though (maybe other things wait on some network handle and seem to freeze until one of the robocopy processes moves on to the next file).

      Also, consider doing it over a Cisco VPN. It seems to add some robustness if there is packet loss. I often had trouble access servers in the US when I was living in China due to packet loss, but no such problem over a VPN (zero packet loss, but very slow instead, which is better).

    4. Re:Robocopy? by Ritchie70 · · Score: 5, Informative

      Actually, you can specify a single file, it just has a silly syntax.

      robocopy source destination file

      So "robocopy c:\a c:\b myfile.txt" will copy c:\a\myfile.txt to c:\b\myfile.txt.

      --
      The preferred solution is to not have a problem.
  5. Use BITS by Lothar · · Score: 5, Informative

    Background Intelligent Transfer Service (BITS) can be used to transfer files between windows servers. It is the technology behind Windows Update. We use it in our company to transfer files across a low bandwidth sattelite connection. Great thing is that it can automatically resume transfer after rebooting both machines. SharpBits offer a nice .NET API. You can find it here: http://www.codeplex.com/sharpbits

  6. BitTorrent by Inf0phreak · · Score: 4, Insightful

    I'd say BitTorrent -- with firewall rules or some other measure so random people can't see your microscopic swarm. It uses SHA-1 hashes of chunks, so if a torrent client says a file downloaded successfully it's pretty much guaranteed to be true.

    --
    ________
    Entranced by anime since late summer 2001 and loving it ^_^
  7. rsync should do the trick by bacchu_anjan · · Score: 5, Insightful

    hi there,

        why don't you get cygwin on both the systems and then do a rsync ?

        between your own network, you might want to use robocopy(http://en.wikipedia.org/wiki/Robocopy).

    BR,
    ~A

    1. Re:rsync should do the trick by ericnils · · Score: 3, Informative

      We use Cygwin's rsync to backup windows servers over a slow Internet connection at work. It works very well for us and using the -z compression option will probably result in much faster transmission over a 2Mbit pipe than FTP will provide. We run rsync as a service on the source and pull to the destination using the rsync command line tool, but you could easily reverse that. You should also consider Microsoft's built-in DFS replication which automates replication of data between two file servers over TCP.

  8. Line endings! by sys.stdout.write · · Score: 5, Insightful

    they've been using FTP to upload the files, but many times the copied files are a few kilobytes smaller than the originals

    Twenty bucks says you're converting from Windows line endings (/n/r) to Linux line endings (/n).

    Use binary mode and you'll be fine.

  9. rsync by itsme1234 · · Score: 5, Informative

    ... is what you want. Yes, you can use it with Windows (with or without cygwin bloat). Use -c and a short --timeout and you're good to go. If you're using it over ssh you're looking at three layers of integrity (rsync checksums, ssh and TCP), two of them quite strong even against malicious attacks not only against normal stuff. Put it in a script with a short --timeout; if anything is wrong with the link your ssh session will freeze completely, as soon as your --timeout is reached rsync will die and your script can respawn a new one (which will resume the transfer using whatever chunks with good checksum you have already transfered and will again checksum the whole file when it finishes).

    1. Re:rsync by doug · · Score: 3, Informative

      Yep, that's what I'd do. The rsync --server means sending signatures instead of files to prevent pointless copies, and it does an excellent job of ensuring good copy or failure. It is certainly better than any ftp variant.

  10. Re:Correct me if I'm wrong... by Dogun · · Score: 3, Informative

    Implementations of TCP in most operating systems fall a bit short of that, killing off stalled connections, etc. Also, some firewall suites, and some routers make a habit of killing off connections after a certain amount of time, sometimes without regard to whether or not they are 'active'.

    You might have some luck boosting reliability with the TcpMaxDataRetransmissions registry setting in Windows. But ultimately, the poster is going to need to find a file copy suite which retries when connections die.

  11. RTFM - set binary mode in FTP by n4djs · · Score: 5, Informative
    'set mode binary' prior to moving the file. I bet the file you are moving isn't a text file with CR-LF line terminations as normally found in DOS, or one side is set and the other isn't.

    Ritchie's Law - assume you have screwed something up *first*, before blaming the tool...

  12. Use .complete files. by Prof.Phreak · · Score: 3, Interesting

    Even on reliable connections, using .complete files is a great idea.

    It works this way: If you're pushing, open ftp, after ftp completes, you check remote filesize, if matches local file size, you also ftp a 0 size .complete file (or a $filename.complete file with md5 checksum, if you want to be extra paranoid).

    Any app that reads that file will first check if .complete file is there.

    If remote file size is less, you resume upload. If remove filesize is more than local, you wipe out remote file and restart.

    Same idea for the reverse side (if you're pulling the file, instead of pushing).

    You can also setup scripts to run every 5 minutes, and only stop retrying once .complete file is written (or read).

    Note that the above would work even if the connection was interrupted and restarted a dozen times during the transmission. [we use this in $bigcorp to transfer hundreds of gigs of financial data per day... seems to work great; never had to care for maintenance windows, 'cause in the end, the file will get there anyway (scripts won't stop trying until data is there)].

    --

    "If anything can go wrong, it will." - Murphy

  13. Re:Guaranteed? by jeffmeden · · Score: 3, Funny

    You forgot a few:

    Windows at both ends... Used to use FTP... Considering windows file sharing...

    Is anyone else a little nervous? I hope by 'government' he means Department of Natural Resources or some equally uninteresting entity. I am picturing someone at the SEC going "You know, I swear this accounting data had a few more rows the last time I looked at it-- Oh well it's not like this Madoff guy is actually up to anything strange anyway"

  14. Re:domyjobforme tag by Anonymous Coward · · Score: 3, Insightful

    Too easily thrown around if you ask me. He's not looking for anyone to set it up, he just wants some options. Isn't that what community is about?

  15. You're kidding, aren't you?? by ballyhoo · · Score: 5, Insightful

    You are kidding about this, aren't you?

    Let me get the facts straight:

    - you have "mission critical files", and the network you're transferring them over is so incredibly badly managed that it doesn't support reliable data transfer
    - you want a technical workaround for this brokenness.

    If this is the case, you don't have a technical problem on your hands; you have a political one.

    "Mission critical" has a meaning: it means critical to the success of the operation. I.e. without these files, your operation or someone else's operation will fail.

    If your management believes that your files are "mission critical", and you're facing a problem of this sort, you need to document the difficulties you're having, along with measurements to support your claims and then make a clear statement that as long as your network path is completely broken, you are absolving yourself of responsiblility for the correct transmission of these files.

    If your management doesn't do anything about this, then the files are not "mission critical".

    1. Re:You're kidding, aren't you?? by Dravik · · Score: 3, Insightful

      Mission critical means that you need to get it done even if someone else isn't getting their job done. Standing around in a huff and stomping your feet means that the mission critical information isn't getting moved. What he needs to do is find a way to accomplish his mission despite the difficulties, and then document the problems so they can be addressed.

      --
      The purpose of language is communication, If the idea is clear the grammar ain't important
  16. Re:Jesus protocol by Loko+Draucarn · · Score: 3, Funny

    Not to mention the three day latency on refreshing the entropy pool.

  17. Re:Jesus protocol by melikamp · · Score: 3, Funny

    It must be open-source with such an odd name.

    Close. It's open sores, especially around the wrists.

  18. Z-Modem FTW! by Cytotoxic · · Score: 5, Insightful

    Crappy connection? Resumable transfers? Slow connections? Sounds like the good old BBS days!

    Z-modem is your answer.