If it's getting to transferring data, then that means you actually have a connection -- however, one of your networks are choking on the data being transferred. There are a few things to try here:
1. Make sure your router firmware is up to date on both sides. Having this out of date can lead to this bug in the router.
2. Make sure your network card drivers are up to date on both sides. These can also cause this bug in the network card driver.
3. If neither of the above work or you want to skip them, there is an option in the settings for working around this: it's called Network Sync Size. There are instructions in the game on how to use it, but basically it chops up the data into smaller bits to avoid the bug in either the router or the network card driver.
4. Alternatively, it might be your drivers and your firmware are fine, but the MTU on your ISP is unusually low. To work around this, there is an MTU setting in the game that lets you down this value as well. You and your friend should both set it to the same value, ideally. Probably not lower than 1000, and really 1200 is probably good enough for most networks except ones configured really strangely (and there are a few).
Given you are playing over Hamachi, I doubt very much that it is #4, because Hamachi is re-encoding all your packets anyhow. So it's most likely the buffer overflowing on your router or network card with it dealing with the large amount of data wrongly. Feel free to start with #3 above for a quick fix, but #1 or #2 would give you a better internet experience in general aside from this game, as well as making the game transfer the data faster when it's first connecting (during gameplay this has no effect on causing lag or anything, by the way).
Hope that helps!